This code enables you to add cross sells on your single product pages conditionally. In this case, only when the product price is 0 as seen in the demo video.
Any products you add to Linked Products > Cross Sells will be displayed.
The code enables you to set the :
- Limit
- Columns
- Orderby
- Order
If you want to display your cross sells on all single product pages, simply remove the code for the conditional check on line 50 in the functions.php file or modify the if statement to suit your own needs.
Installation
There’s 3 steps :
Step 1 – Copy and paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions file or custom functionality plugin.
Step 2 – Upload the file named single-cross-sells.php to your child theme folder or woocommerce folder. You can modify this template.
Step 3 – Copy and paste the CSS from the style.css file to the end of your child themes style sheet and clear caching.
Reviews
There are no reviews yet.