Open seanheartmath opened 1 year ago
This could be an issue with a missing comma or a timing issue.
When I click 'Subscribe' on the PDP, this is what I observe in browser network logging:
POST to the BC endpoint when the Cart is created:
quantity: 1, product_id: 1322, list_price: 240, name: "Subscription:Stripe Test 2"
POST to /api/cart/CART_HASH immediately after:
list_price: 240, name: "Subscription:Stripe Test 2 :price_1NBR5oGn0p4ZokFkppsHWijG", product_id: 1322, quantity: 1
I think this formatting on the subsequent POST request:
name: "Subscription:Stripe Test 2 :price_1NBR5oGn0p4ZokFkppsHWijG"
Should be:
name: "Subscription:Stripe Test 2", price: "_1NBR5oGn0p4ZokFkppsHWijG"
or
name: {Subscription: "Stripe Test 2"}, price: "_1NBR5oGn0p4ZokFkppsHWijG"
@seanheartmath we we initially developed the app, this was done because Cart Metafields weren't broadly available. Now they are: https://developer.bigcommerce.com/docs/rest-management/carts/metafields
To do this, high level:
cart_id
on the order, fetch the Cart Metafields and use that info to determine the Stripe Price ID, instead of parsing the product name to find it: https://github.com/bigcommerce/subscription-foundation/blob/main/src/pages/api/webhooks/index.ts#L98Does that seem like something you'd be interested in contributing back to the codebase? We set up some time to dive into the details if you need more info!
Hi Nate,
Thanks for the info, that makes sense. I am interested in contributing to the project, I’m a little busy this week but I’ll look at the fixes you proposed and start thinking about implementing a potential fix on my side. I’d be happy to meet and discuss in detail with you sometime next week when you have availability.
Thanks,
Sean Callahan Senior Web Developer, HeartMathhttps://www.heartmath.com/
From: Nate Stewart @.> Reply-To: bigcommerce/subscription-foundation @.> Date: Monday, June 5, 2023 at 8:16 PM To: bigcommerce/subscription-foundation @.> Cc: Sean Callahan @.>, Mention @.***> Subject: Re: [bigcommerce/subscription-foundation] Products added to subscription channel printing a price string and hash (Issue #34)
@seanheartmathhttps://github.com/seanheartmath we we initially developed the app, this was done because Cart Metafields weren't broadly available. Now they are: https://developer.bigcommerce.com/docs/rest-management/carts/metafieldshttps://developer.bigcommerce.com/docs/rest-management/carts/metafields
To do this, high level:
Does that seem like something you'd be interested in contributing back to the codebase? We set up some time to dive into the details if you need more info!
— Reply to this email directly, view it on GitHubhttps://github.com/bigcommerce/subscription-foundation/issues/34#issuecomment-1577834839, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXO6MLFXTIQCBHRNYY3WUQ3XJ2OKJANCNFSM6AAAAAAYODA224. You are receiving this because you were mentioned.Message ID: @.***>
@seanheartmath alright, let's meet up to discuss this then! Shoot me some times to my bigcommerce.com address (nate.stewart) that work for you next week and I'll send over an invite.
Every product I add to the subscriptions channel prints out extraneous data when added to the cart such as :
Subscription:Stripe Test 2 :price_1NBR5oGn0p4ZokFkppsHWijG