Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password?

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

Discount- Changing $item['price']

(4 posts) (2 voices)
  • Started 3 months ago by usr_local
  • Latest reply from amin007
  • Related Topics:
    1. Get PRODUCT NAME from title attribute and PRICE from custom field?
    2. Paypal Checkout Page not showing Product Descriptions for more than one item
    3. Free Shipping for Quantity > 1
    4. Thank You Page - Problem with discount codes
    5. discount codes and conditional application

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 3 months 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 3 months 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 3 months 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 3 months 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