Woocommerce Variable Product missing Price field

#48626
  • Resolved Rajat Wadehra
    Rank Math free

    Hi, I have implemented the variable product code which is:

    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    	global $product;
    	if ( $product->is_type( 'variable' ) ) {
    		$variations = $product->get_available_variations();
    		foreach ( $variations as $key => $variation ) {
    			$entity['offers'][ $key ]['priceValidUntil'] = '2021-01-01';
    		}
    	} else {
    		$entity['offers']['priceValidUntil'] = '2021-01-01';
    	}
    
    	return $entity;
    });

    With the help of the snippet, the variable products started to show in the schema but initial product price stays “0”, with no SKU.

    Would you please help me with this, as most of the products on my website are variable products.

    Waiting to hear from you.
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math today.

    I have tested your links on the SDTT but I cannot replicate any errors as shown below:
    Screenshot

    Looking forward to helping you. Thank you.

    ​​​​​​

    Image from SDTT

    https://ibb.co/YP4Mp9J

    Hello,

    Thank you for contacting Rank Math today.

    I am using the same url and getting only three warnings and no errors. Here is a screenshot: https://i.rankmath.com/bTplD8

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Woocommerce Variable Product missing Price field’ is closed to new replies.