Recalculate discounts in prestashop cart - prestashop

I'm working on prestashop shop where are used coupon with % discounts. We don't want to use coupons on products on sale but still want to buy products on sale and normal products in the same cart. I want to recalculate discounts in cart and order to apply only on non-sale products. I need help which file I should edit or where add functions to do it.

You should create a module that adds dedicated cart rules or customer-related specific prices on the products you are interested in when customer changes his cart or validate the order.
There are plenty of native Prestashop hooks you can use for that so you don't need tweaking with the core.
Keep in mind that there are a lot of "advanced cart rules" modules out there, so consider having a look before reinventing the wheel.

Related

Shopify changing product price for variation by app

I am a shopify partner, I am trying to get around the the variant limits of shopify by coding an app and also because my client has a complicated formula for calculating the price. I don't have a problem with the part that adds the information for my variants to the order, however when I want to modify the price based on the user selection, it doesn't seem an easy task to do.
I came across couple of apps which does the same thing by adding a new product or variation which is not optimal for my use case, is there any app that does the job without adding extra information to the database, if so, how?
Qualified Yes
Unfortunately, Shopify doesn't give us a lot of options to edit prices of items dynamically. Here are the two options that I know of that will allow you to adjust the price of a product directly - however, both have limitations.
Using Shopify Script Editor
If you're working with a Shopify Plus merchant, you can use the Shopify Script Editor to dynamically adjust the prices of products, provided that the direction you adjust is down. You cannot increase the price of a product using the script editor - so for your use case, the list price would have to be the most expensive possible price that the item sells for, which you would then discount appropriately using the app.
Using draft orders
Using an app, you can use Shopify's Draft Order API to create an order with custom discounts and/or create completely custom items that are independent of the products set up in the product database.
The basic flow for this is that when the customer clicks 'checkout' you halt the normal navigation, send the cart contents to your app, create a draft order with the appropriate pricing, then supply the front-end code with the draft-order checkout/invoice URL so that you can send the customer there instead of the normal checkout. This has several limitations, however, including that prices of existing products can only be discounted, not increased, and the fact that Shopify will not allow a customer to use discount codes on a draft order invoice - once an order is set up this way, Shopify's assumption is that all prices are final.
Disclaimer: Sorry if someone sensible doesn't like a response with a link :) I'm not related to this app I'm just a user.
On a project with complex pricing, we use the app Wholesale Pricing Discount by Wholesale Helper we liked because is easy to import multiple pricing by-product and relate it by customer.
this app does not multiply the products, they use customer tags. maybe that can give you some guidance.
An important rule on Shopify is you can't increase the price by API on an order, you can just reduce i

Prestashop configure product attribute without stock

In PrestaShop, I saw that attributes are involved in stocks calculation. Is it possible to avoid that?
Here is an example: my shop sells a product with the option "Giftbox". The gift box has a cost of 2€, but it has not a stock. In the admin product page, Prestashop asks me for a stock, but the gift box is not related to the product itself.
Thank you
If you use Prestashop >= 1.7 you can set Gitf Options without attributes. You can find it in Preferences->Orders.

Shopify update the inventory for the custom bundle

I am trying to create a bundle for the Shopify site. I do not want to use the Shopify app to create the bundle. Product A has 30 variants. A customer has to buy 6 quantity of variants at a time. It could be any 6 variants. How can I update the inventory for all the variants when the checkout is done?
You don't update inventory, Shopify updates inventory. Your job instead is to ensure the correct number of variants go into the checkout. If you have trouble with that, you can always help yourself out with some clever product manipulations. Another solution is to listen to the checkout and examine the products sold. You can then alter inventory levels to suit your needs.
Almost all the bundle Apps do the same thing. You can try them out and see if that squares your circle. I made one of the original bundlers whereby I had it so in a bundle, made of N products, the merchant could tag each variant for a specific quantity, and then the customer would be buying those specific quantities when buying the product. I would use Ajax calls to check quantity live, and when the product was purchased I would then deduct the right inventory quantities because the product itself had infinite quantity.
That was very sophisticated and worked most of the time, but completely messed up when customers would SIT on the cart. Inventory levels would change, and valid carts at the time would become stale, and inventory would be messed up, resulting in overselling stock. Me bad. Shopify bad. Bundling bad. With Shopify Plus, all that kind of went out the window, and bundles are much easier. Without Plus, you gamble!

How to bundle product in shopify?

I tried to develop a Shopify application and I needed to bundle some products and sell those together with the special discount values.
There are some apps like product-bundle but I need bundling product in my app.
I tried to create one product similar to them and after the purchase completed I delete it but I think it's not a good solution because this product will be shown to shop and other customers can purchase that while I want to offer this product to a certain customer only.
In another way, I tried to use Shopify discount but can't satisfy my need or maybe I can't find true ways.
How can I do that?
There are multiple ways in which you can handle this.
1) Create a product itself:
Create a single product indicating a combination of your desired multiple products and combination of your price.
When the customer adds all the related products, detect it from cart webhook and update the cart of the customer by removing such products and adding the single product(i.e combination of all products).
2) Create a discount code: Create a discount code with your desired discount amount for each combo. Detect the products in the cart by cart webhook, if combo products found automatically apply the coupon to the cart.

Shopping cart - the right way?

I need to implement shopping cart for my website. I decided to store carts in database rather that in session. My website serves as a platform for selling items between users. That said, users can edit their own products any time.
I understand that I can't just use product ID in the cart, because user need to get whatever he put to the cart. If the product is being changed after he put it to the cart, it shouldn't affect what he ordered, correct?
How is it usually solved? Should I copy entire product to the cart? Or maybe rather save versions of particular product and link to them? Another idea would be to inform customer on checkout that the product changed.
How is it solved in popular e-commerce platforms?
I understand that I can't just use product ID in the cart, because
user need to get whatever he put to the cart. If the product is being
changed after he put it to the cart, it shouldn't affect what he
ordered, correct?
the product price is going to change. the inventory is going to change. if a product goes out of inventory you want the customer to know so they can make another choice. if the product price has gone up or down, the cart should reflect the current price. so that means the cart will check the product table for the product pricing and inventory at different steps before the final transaction.
as part of the cart to product lookup -- if the pricing has changed you can alert the user. just as important - if the customer has ordered quantity 4 of a product, but the inventory has gone down to just 3 of them -- you have to change the cart and make it very obvious to the customer what just happened.
there are only two things the cart is responsible for - the product id, and the quantity to be sold. anything else stored in the cart is just to make it easier to display the product on the cart page or information needed for the merchant.