WC: Negative Stock from Order while Backorder is disabled - caching

This is my problem: a customer bought a product that was out of stock. So the stock went from 0 to -1.
My out of stock threshold is at 0 and back ordering is disabled with all products.
I tried to recreate the scenario on my staging site but it was not possible to me. The product is greyed out and not selectable when I set its quantity to 0.
I thought maybe some caching issue (I'm using Hummingbird) prevented it from updating the stock. So these were the further scenarios I tried:
- selecting product on single product page, set stock in back-end to 0 --> not possible
- product in basket, set stock in back-end to 0 --> not possible
- product in checkout, set stock in back-end to 0 --> not possible
Would anyone of you know how it could have happened? I'm not sure how to proceed.
thanks
Jan

After carefully reading the WooCommerce source code I think you can recreate the problem if you have two computers.
Consider a product P with stock quantity equal to 1. There are 2 different customers A and B. Customer A puts product P into his cart. Before customer A places his order customer B puts product P into his cart. Then customer A places his order reducing the stock quantity of product P to 0. Then customer B places his order reducing the stock quantity of product P to -1. Unfortunately to test this it requires two computers (or two browsers) since you need two simultaneously logged in customers. I only have one computer and don't want to install another browser.
The problem is in the function WC_Cart::add_to_cart(). It calls WC_Product::has_enough_stock() with references to only the stock quantity of the product and the quantity ordered in its cart. It doesn't not take into account the quantities of the product that exists in other carts. In fact WooCommerce should be able to do better as it has knowledge of the contents of customer A's cart when customer B adds product P to his cart A.
Of course there is a bit of a dilemma here because if WooCommerce prevents customer B from adding product P to his cart because customer A has it in his cart and customer A doesn't actual place the order then the company may have lost a sale.
Alternatively, WooCommerce can reject customer B's order when B places the order but unless I missed something I did not see any code to do that. That would seem to me to be a reasonable solution.

Related

Quantity Bought Confusion on Magento Software

We have a Magento software and we are using platform to sell travel deals.
Now when we for instance block say 20 spaces and someone makes a purchase for say 10 people in one bulk purchase, the Quantity bought shows as 1 and it is possible to buy for more people because because the remaining quantity left shows as 19 out of 20 and this is a huge problem because people will still be able to purchase products that are sold out.
Does anyone know how to make the Quantity remaining be a subtraction of the total bought from the total quantity (as opposed to seeing every bulk purchase as 1 Quantity?
Any help will be greatly appreciated.
I think you are defining stock value for block size which is not good way. Add custom attribute for block size and disable stock management, follow steps below
Admin -> System -> Configuration
Select Inventory under Catalog (on left nav bar)
Look Product Stock Options, Set No to Manage Stock. and Save

How to set a rule for buying two products together to reduce the total price?

I am trying to make a block which shows two products in it with a rule that if a customer bought these two products together the total amount will be reduce by some extent.
e.g. if product A is of $100 and B is of $75, then both will be buy together for $150.
Can anyone has an idea how to apply these kind of promotion rules in magento. I really need to do this as the client need this kind of functionality on its product view page.
Magento provides a default functionality to create bundle products.
Use following url for reference:
http://www.magentocommerce.com/knowledge-base/entry/creating-a-bundled-product
There are two options that you could use:
1) Setting up a bundled product (with a Price Type = Fixed Price), setting product A and product B to be its children and setting $150 as its price.
However, there are few limitations to this solution:
The customer can't just add product A or product B to cart separately from the bundled product page, he can only add them together. That is the customer will need to go to a separate page to purchase product A (or product B) standalone.
Once the user added the bundled product to his cart, he can't just remove one child product from the cart (e.g product A) - he has to remove both.
2) You can use an extension for it. One of the extensions that implement this functionality is Bundled Discount. It allows you to set the product A and the product B and set the special price whenever they are purchased together (eg: $150).
It also allows you to create a separate page for the bundled promotion. This way, the user can select whether he wants to add only the product A for $100, the product B for $75, all both for $150.
The user can also remove one of the products from his cart and only pay for another product (eg: the user removes the product A from his cart and only pays $75 for the product B).
Disclaimer: I am the CEO of the company that developed the Bundled Discount extension.

Expresso Store - Exclude Product from Order Quantity

I'm using Expresso-Store to process product orders for a non-profit. In addition to selling a range of handmade products we are offering visitors an option to donate.
I have most of the donation stuff working just fine. I used Justin Long's advice posted here: http://iamjustinlong.com/blog/single/accepting_donations_with_expresso_store/
As suggested I have created a channel for all the products and then a separate channel which holds a single "Donation" product with a cost of $1.00. The visitor adjusts the quantity of this item which results in a donation amount of $1.00 * qty.
The specific problem I'm running into is displaying the total quantity of items in the cart when there's also a "Donation" product added. Since the donation amount is determined by quantity * $1.00 but in reality it represents a single donation, my {order_qty} is way off since it includes the many multiples of Donation products.
I have a small cart icon that is displaying a number above and next to it with the {order_qty} but I need to exclude the donation product from this calculation. How might I go about this?
This would be fairly difficult to do using the current version. The best I can suggest is not to display the {order_qty} on your checkout page (most sites only display the total anyway).
However, in saying that, the next version of Store has first-class donations support, so it will soon be possible.

Magento-Custom shopping cart price rule - Buy 2 different products and get those for flate rate?

I want to set up different kind of price rules(shopping cart price rules) for my client. I tried default magento's extension, but I couldn't. when I searched in the net, some solutions told that using observer can solve my problem. But those weren't enough for me. Let me explain one of my problem.
Buy 2 different products and get those for flat rate.
Say, Product X is 700 and Product Y is 500. When customer buys those 2 products (Total 1200), he can get both products for 1000.
is there any straight way to do this or should need to create custom module with database table and observer?
First Specified Your X and Y SKU and put this condition and action and apply discount amount.
If you don't found SKU in condition, then change in the SKU attribute to apply shopping rule to YES

Programmatically apply a discount price in product list

I would like to programmatically display a discounted price on the product list/page so that each customer as a personal price shown based on a customer attribute (like gender for instance, and of course let it be assigned as new price for the user session) but I can't see a viable option via the magento catalog price rules involving customer attributes other than the assigned group.
I'm using the group to do different kind of discounts and categorization of the customers, so the path of "split the customers on the gender" (or similar) is not an option unfortunately, since I can't assign more than 1 group per customer.
At the moment I was thinking about setting up a custom observer to check for calls to the price generation and then let it consider my customer attributes when calculating the price.
Is that possible? if so, any pointers about?
Would you suggest something different?
Thanks a lot to everyone for your time.
As I was thinking before, I solved my issue creating a custom module with an observer looking for catalog_product_get_final_price calls, getting the customer details from the current customer session.
It works great, I just need to let it display the correct price in the catalog product list, but is minimal, as the price seems to be calculated correctly inside the product page and the cart

Resources