-
-
Save leewillis77/e9f9cf6c26f391314319b5195787d9e8 to your computer and use it in GitHub Desktop.
Fix issue where woodmart theme removes variable products from the Google Product Feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_gpf_wc_get_products_args', function ( $args ) { | |
if ( class_exists( '\XTS\Modules\Show_Single_Variations\Query' ) ) { | |
$woodmart_module = \XTS\Modules\Show_Single_Variations\Query::get_instance(); | |
remove_action( 'posts_clauses', [ $woodmart_module, 'posts_clauses' ], 100, 2 ); | |
remove_action( 'pre_get_posts', [ $woodmart_module, 'add_variations_to_product_query' ] ); | |
remove_action( 'woocommerce_product_query', [ $woodmart_module, 'add_variations_to_query' ], 50, 1 ); | |
remove_action( 'woodmart_quick_view_posts_args', [ $woodmart_module, 'add_variations_to_quickview' ], 10, 1 ); | |
remove_filter( 'woocommerce_product_title', [ $woodmart_module, 'variation_title' ], 10, 2 ); | |
remove_filter( 'woocommerce_product_variation_title', [ $woodmart_module, 'variation_title' ], 10, 4 ); | |
remove_filter( 'woocommerce_product_variation_get_average_rating', [ $woodmart_module, 'get_average_rating' ], 10, 2 ); | |
remove_filter( 'get_the_excerpt', [ $woodmart_module, 'get_the_excerpt' ], 10, 2 ); | |
remove_action( 'woocommerce_display_product_attributes', [ $woodmart_module, 'variation_product_attributes' ], 10, 2 ); | |
} | |
return $args; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment