Advertisement
vapvarun

Display Requirement on single product page : Woo Sell Services

Apr 11th, 2021
1,061
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. add_action( 'woocommerce_before_add_to_cart_button', 'woo_sell_service_question_delivery');
  2. function woo_sell_service_question_delivery(){
  3.     if ( is_product() ) {
  4.         $estimate_time = get_post_meta( get_the_ID(), 'wbcom_wss_estimate_time', true);
  5.         $product_requirement = get_field( "woo_sell_services_requirement_data", get_the_ID() );
  6.         echo "Estimate Delivery Time: " . $estimate_time .  ( ( $estimate_time > 1) ? ' Days' : ' Day' ) ;
  7.         if (!empty($product_requirement)) {
  8.             echo "<ul>";
  9.             foreach( $product_requirement as $requirement ) {
  10.                 echo "<li>";
  11.                 //print_r($requirement);
  12.                 echo $requirement['woo_sell_question'];
  13.                 echo "</li>";
  14.             }
  15.             echo "</ul>";          
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement