Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password?

Search the Forum

Tips and Tricks HQ Forum » Simple PayPal Shopping Cart » Simple Shopping Cart Tweaks

Discount- Changing $item['price']

(4 posts) (2 voices)
  • Started 1 year ago by usr_local
  • Latest reply from amin007
  • Related Topics:
    1. Continue shopping link doesn't link anywhere- Stays on checkout
    2. Get PRICE on other website?
    3. Remove Price from Download Now Button Display
    4. Any way to do a bulk price change?
    5. display TTC price (tax included) on product page

Tags:

  • discounts
  • items
  • price
  • shipping costs
  1. usr_local
    Member

    This is similar to the shipping cost post. Am attempting to drop the item price by 1 if item quantity is > 2. I tried this and got no results at all. Any ideas or help with my coding would be great. I am no PHP guru. Thanks!

    This is what I added to the function:

    {
    if ($item['quantity'] > 2)
    {
    $item['price'] += $item['price'] - 1;
    return $item['price'];
    $total += $item['price'] * $item['quantity'];
    }
    else
    {
    $total += $item['price'] * $item['quantity'];
    }

    $item_total_shipping += $item['shipping'] * $item['quantity'];
    $total_items += $item['quantity'];
    }

    Posted 1 year ago #
  2. amin007
    Key Master

    Can you please post a link to the shipping cost post that you are referring to so we can both be on the same page?

    Posted 1 year ago #
  3. usr_local
    Member

    http://www.tipsandtricks-hq.com/forum/topic/free-shipping-for-quantity-1

    There ya go admin007. Thats where I got the idea that my code edit might work.

    Posted 1 year ago #
  4. amin007
    Key Master

    You won't be able to follow that shipping cost example and do what you are after. It's because you will need to modify the item price itself if the quantity is greater than 2 and modification needs to happen when the "Add to Cart" button is clicked or the quantity change happens. So you code to change the item price needs to go inside the if ($_POST['addcart']) block of code and also in the else if ($_POST['cquantity']) block.

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Tips and Tricks HQ Forum is proudly powered by bbPress

Tips and Tricks HQ  | WP Shopping Cart  | WP Affiliate Software  | WordPress Membership Plugin