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 | |
/** | |
* Automatically adding the product to the cart. | |
*/ | |
function aaptc_add_product_to_cart( $item_key, $product_id ) { | |
$product_category_id = array( 16, 17, 18 ); // Category ids of A, B and C | |
$product_cats_ids = wc_get_product_term_ids( $product_id, 'product_cat' ); | |
$product_category_id_check = false; |
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 | |
/* | |
* Automatically adding the product to the cart when cart total amount reach to $500. | |
*/ | |
function aapc_add_product_to_cart() { | |
global $woocommerce; | |
$cart_total = 500; |