vapvarun icon

Display Requirement on single product page : Woo Sell Services

vapvarun | PRO | 04/11/21 10:50:07 AM UTC | 0 ⭐ | 1453 👁️ | Never ⏰ | []
PHP |

680 B

|

None

|

0 👍

/

0 👎

add_action( 'woocommerce_before_add_to_cart_button', 'woo_sell_service_question_delivery');
function woo_sell_service_question_delivery(){
    if ( is_product() ) {
        $estimate_time = get_post_meta( get_the_ID(), 'wbcom_wss_estimate_time', true);
        $product_requirement = get_field( "woo_sell_services_requirement_data", get_the_ID() );
        echo "Estimate Delivery Time: " . $estimate_time .  ( ( $estimate_time > 1) ? ' Days' : ' Day' ) ;
        if (!empty($product_requirement)) {
            echo "<ul>";
            foreach( $product_requirement as $requirement ) {
                echo "<li>";
                //print_r($requirement);
                echo $requirement['woo_sell_question'];
                echo "</li>";
            }
            echo "</ul>";           
        }
    }
}

Comments