In my Shopify website, users are able to add any number of units for a product irrespective of the inventory. The stock is only checked when users click on checkout. How can I handle this issue?
Ideally, users should be able to add only available inventory to the cart. It's annoying when someone adds multiple quantities only to know they aren't in stock.
You need to check the variant.inventory_quantity => https://shopify.dev/docs/themes/liquid/reference/objects/variant#variant-inventory_quantity
If you have no option you can get it like so product.first_available_variant.inventory_quantity.
But if you have multiply options you will need to loop all the variants and create a JS object that will store each variant inventory_quantity and perform a JS check or update the max attribute of the number input for the quantity before adding the product to the cart.
Related
I trying to allow users to get the first product sample they add to their cart for free, but any samples they add after (including the one they already added) should be normal price. Right now I using setOriginalCustomPrice in a module, but the customer can change the quantity, and the price stays at zero instead of going up. Anyone know how to go about this?
You can achieve this by a simple calculation where you are using setOriginalCustomPrice.Currently I think you are setting price 0.Instead of doing this,use following logic to set custom price.
$customPrice=$qtyincart*$productPrice-$productPrice.
So if user add 1 qty then $customPrice will be 0 else will equal to sum of qty-1.
I hope this solve your purpose.
I have my shopping website in opencart and i want to put certain conditions on particular products in my store.
For example: I have a product in my store and i want to put following order condition on it.
Conditions: You need to order at least $50.00 in products to be able to to purchase this
Could you please tell me which is the correct way to do it?
There's no default method for that, AFAIK. You have to write a simple VQMod, which will check order subtotal upon add to cart operation.
I need to know if there is a way to create this in Magento:
First of all, all my products price are fixed: 9.99$.
So i want to do this: if the client bought three products, the third is free, so it pays 2 products. He can do this as many times as they want, so if you buy 6 products, there will be 2 product free, if he buys 9 products, 3 are free
Magneto supports buy x get y free promotions. Information about setting them up is available at http://www.magentocommerce.com/knowledge-base/entry/how-to-setup-buy-x-get-y-free
It's possible to do this using magento Shoping Cart Price rules.
Create a Shoping cart price rule by going to your admin panel and clicking on Promotions -> Shoping Cart Price rules.
Create a condition for your rule. There is a nice GUI to define the conditions so they will look like: If an item is FOUND in the cart with ALL of these conditions true
Define an Action, actions describe how prices are updated when the conditions of the rule are met. In your case there is an specific action called: Buy X get Y Free, which defines a quantity that the customer must purchase to receive a quantity for free. (The Discount Amount is Y.)
Complete the labels: lables appears on the order below the subtotal to identify the discount. You can enter a default label for all store views, or enter a different label for each view.
Apply the rule. Make sure you save and enable the rule, also you can define a time range when the rule is valid and number of usages.
For more details check here:
http://docs.magento.com/m1/ce/user_guide/marketing/price-rule-shopping-cart-buy-x-get-y-free.html
I currently have an issue trying to restrict customers to purchasing 2 of a product max.
So far, I can set the max number of the product in the cart to 2 using catalog/manage products, select the product, then inventory and adjusting the max Qty allowed in cart to 2.
However, this will not stop the user coming back another day and purchasing another 2 items.
What I would like to do is create a rule so that when the user logs in and tries to purchase the product, after already purchasing it, the code will throw an error saying that they have reached their max quantity and prevent the cart from processing the order.
I believe that I would have to edit one of the php files to run a check against the users id and the product id, but I am unsure which file will need to be edited.
Magento ver. 1.3.2.4
Links that helped me, hope it helps:
step 1
step 2
First of all create one observer checkout_cart_add_product_before
In this observer event check cart quantity of product, you can get qoute item from quote object and from quote retrieve product quantity and match with newly added product if condition satisfied then redirect customer to product details page with mesage
To support future compatibility and prevent your changes from being overwritten you should create a custom extension that hooks into the core.
You might try the hook: checkout_cart_add_product_complete or checkout_cart_add_product_before and test the number of items of each product. Based on that result you might automatically remove the item and parse an error.
I have some simple products setup that have various custom options, some of which are set to required. What I would like to do is get the products set up to where the customer can choose from predefined quantities for a certain price.
For example say the product is a widget, i want the customer to be able to choose from say 100 for $20, 200 for $35, 500 for $80 ..... and so on.
Tiered Pricing doesn't work since the prices are increasing.
I tried using a custom options which worked out price-wise BUT it did not update the total weight of the product which I need calculated in order to calculate shipping quotes.
I also tried using group products and setting the products within the group as the specific quantities and setting the calculated weights BUT it doesn't allow me to keep the custom options i have set as required.
So right now I'm just at a lost. Any Ideas how i can get this setup with the predefined quantities that also updates weight for shipping?
I'm using magento 1.6.0
Well after some more searching I found something that works....
http://www.magentocommerce.com/boards/viewthread/73036/