Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    I have honestly spent several days trying to find out where to add the condition microdata, help please.

    I don’t know if this is red herring but if I use the inspect feature in Chrome I can see itemprops of “price”, “pricecurrency”, “availability” on my web pages. Chrome indicates it is part of div.summary.entry-summary? But I cannot find that aywhere. I am using child theme twenty-twelve.

    Any help would be gratefully received. Thank you.

    Hi James,

    Yes it displays “In Stock”, see https://www.hart-expert.co.uk/online-shop, currently everything is in stock.

    Regards,

    Robin

    To help others, I wanted to vary the text displayed at product level, some products take longer than others to produce. So in the woocommerce product page I created a custom field called “Out_of_stock_message” and in it I put like “Lead time is 2 weeks”.

    Then in my child themes functions.php file I added this…

    add_filter( 'woocommerce_get_availability' , 'revised_woocommerce_get_availability' , 10, 2 );
    
    function revised_woocommerce_get_availability( $available_array , $product) {
    
    if ( $product->managing_stock() ) {
    
      if ( !($product->is_in_stock() && $product->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount' ))  && ($product->backorders_allowed() && $product->backorders_require_notification())  ) {
    
      $custom_meta_value = get_post_meta( $product->id, 'Out_of_stock_message', true );
    	$available_array["availability"] = $custom_meta_value;
       }
    }
    
        return $available_array;
    }

    This only affects the product page, not the cart/basket page. Hope that helps someone.

    To help others, I wanted to vary the text displayed at product level, some products take longer than others to produce. So in the woocommece product page I created a custom field called “Out_of_stock_message” and in it I put like “Lead time is 2 weeks”.

    Then in my child themes functions.php file I added this…

    add_filter( 'woocommerce_get_availability' , 'revised_woocommerce_get_availability' , 10, 2 );
    
    function revised_woocommerce_get_availability( $available_array , $product) {
    
    if ( $product->managing_stock() ) {
    
      if ( !($product->is_in_stock() && $product->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount' ))  && ($product->backorders_allowed() && $product->backorders_require_notification())  ) {
    
      $custom_meta_value = get_post_meta( $product->id, 'Out_of_stock_message', true );
    	$available_array["availability"] = $custom_meta_value;
       }
    }
    
        return $available_array;
    }

    This only affects the product page, not the cart/basket page. Hope that helps someone.

    Hi James,

    Did you solve this problem, I am trying to do the same thing.

    Your help please.

Viewing 5 replies - 1 through 5 (of 5 total)