Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author mra13

    (@mra13)

    Hi Mishli, The simple shopping cart plugin doesn’t have a category based discount feature. So I am guessing you made some custom tweaks yourself to make this happen. Can’t you add a check in the code that you added to only execute when it matches your category condition?

    Thread Starter mishli

    (@mishli)

    Thanks for the reply.

    I’ve just managed to do it in a similar way to what you suggested.
    Works great for me. If anyone would like the code I can share it here just let me know.

    Plugin Author mra13

    (@mra13)

    Please share the code so I can take a look too.

    Thread Starter mishli

    (@mishli)

    $price = get_post_meta( $book->ID, "price", true );
    $discount_price = round($price*0.80);
    
    $categoriesList = get_the_term_list( $book->ID, "category" , "", ' ', "" );
    $catObj = get_category_by_slug($categoriesList);
    $cat_id = $catObj->term_id;
    
     if  ($cat_id == 1)
    	echo print_wp_cart_button_for_product("$book_title", "$discount_price", 0.0001 );
    else
    	echo print_wp_cart_button_for_product("$book_title", "$price", 0.0001 );
    Plugin Author mra13

    (@mra13)

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Get category of products’ is closed to new replies.