Last active
February 24, 2024 10:05
-
-
Save RiaanKnoetze/e14420d8ede60a7701856c7a8ba7e350 to your computer and use it in GitHub Desktop.
Cross Sell Auto Generator
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 | |
/** | |
* Filter the cross-sells displayed in the cart to always show specific products. | |
*/ | |
function custom_filter_woocommerce_cart_cross_sells( $cross_sell_ids, $cart ) { | |
// Specify the IDs of the products you want to always show as cross-sells. | |
$custom_cross_sell_ids = array( '1', '2' ); | |
// Return your custom cross-sell product IDs. | |
return $custom_cross_sell_ids; | |
} | |
add_filter( 'woocommerce_cart_crosssell_ids', 'custom_filter_woocommerce_cart_cross_sells', 10, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment