Woocommerce Variable Product missing Price field

  • 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)
Viewing 3 replies - 1 through 3 (of 3 total)

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