Replies: 4 comments 4 replies
-
Neither of those functions "know" anything about the requested product's currently-selected attributes. function zen_get_products_stock($products_id) ...
function zen_check_stock($products_id, $products_quantity) ... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Is this in relation to a public addon/plugin? I was considering some other potential notifiers, and seeing your logic around variant-handling would be helpful to inform the decision-making. |
Beta Was this translation helpful? Give feedback.
0 replies
-
There's already an observer in both functions. It just needs an array of
attributes added to it and then we can manage variant stock without editing
the core function.
…On Mon., Apr. 15, 2024, 2:46 p.m. Chris Brown, ***@***.***> wrote:
use the observer for managing variant stock
Is this in relation to a public addon/plugin?
I was considering some other potential notifiers, and seeing your logic
around variant-handling would be helpful to inform the decision-making.
—
Reply to this email directly, view it on GitHub
<#6401 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAS7WKJN4W3VA4ZWJKBPCHLY5RDCDAVCNFSM6AAAAABGHYUS3CVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TCMRTGEZTA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
-
Yes, we could use the existing observer to connect to the session. However
we may be wanting to use it prior to the product being in the cart, such as
when displaying inventory on a product page or checking stock before
adding. We can then use that function and pass it the attributes. Still
requires core edits in some areas, but no longer needing to edit the
function itself will be a big help and easier to maintain.
…On Tue., Apr. 16, 2024, 5:52 a.m. lat9, ***@***.***> wrote:
My bad, the $products_id input to each of those functions is either the
associated product's id or a prid (an id suffixed with the md5 hash of
its attributes). If the observer of the notification sees that the value's
the latter, the observer can look-up in the $_SESSION['cart']'s contents
array to find the array of associated attributes.
—
Reply to this email directly, view it on GitHub
<#6401 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAS7WKMJWQHVHD6XV6KPVOLY5UNKPAVCNFSM6AAAAABGHYUS3CVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TCMRZHA4TG>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can you please also add a parameter to the zen_get_products_stock and zen_check_stock functions called $attributes? This way we can use the observer for managing variant stock.
Beta Was this translation helpful? Give feedback.
All reactions