priceValidUntil missing

  • Hi,

    i can not setup the priceValidUntil on variable product.

    Have found this fix for product feed, but i use the schema from rank math:

    // priceValidUntil
    
    function func_woocommerce_structured_data_product_offer( $markup, $product ) {
    
    	if ( empty( $markup[ 'priceValidUntil' ] ) ) {
    		$markup[ 'priceValidUntil' ] = '2050-01-01';
    	}		
    	return $markup;
    
    }
    
    add_filter( 'woocommerce_structured_data_product_offer', 'func_woocommerce_structured_data_product_offer', 10, 2 );

    which hook in rank math or woocommerce addon can i use for it? Thanks!

    • This topic was modified 4 months, 2 weeks ago by Martin.
    • This topic was modified 4 months, 2 weeks ago by Martin.
Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can use the following code to achieve the same in Rank Math:

    
    /**
     * Filter to modify Rank Math product schema data
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	$entity['offers']['priceValidUntil'] = '2050-01-01';
    	
    	return $entity;
    });

    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 1 replies (of 1 total)

The ticket ‘priceValidUntil missing’ is closed to new replies.