ckmcgowan
Forum Replies Created
-
Perfect – exactly what I was looking for 😉
Yes I realise this but I was just wondering the best way to beable to retrieve that cart key on the woo commerce site after I direct the customer back so what I have added via the CartCo API then shows in the cart on the woocomerce site so the customer can complete the checkout as normal.
Doh! – Just realised that 😉
Last question – I can’t seem to find away to access the cookie under Set-Cookie you mention for guest cart via a php curl call? if I enable CURL_OPTHEADER I can see the following so can grab the X-CoCart-API value:HTTP/1.1 200 OK
Date: Thu, 07 Jan 2021 10:17:01 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
X-Powered-By: PHP/7.3.23
X-Robots-Tag: noindex
Link: <https://mydomain.com/wp-json/>; rel=”https://api.w.org/”
X-Content-Type-Options: nosniff
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages, Link
Access-Control-Allow-Headers: Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type
X-CoCart-API: 7747bda0ce7c26307b8f5a0e1dfcd00a
Allow: GET
Vary: Origin
Transfer-Encoding: chunked
Content-Type: application/json; charset=UTF-8But can’t see anything via Set-Cookie? Am I misinterpreting what the API should return on a call?
Many Thanks
Chris
Thanks – I sorted it by adding CURLOPT_POST => true to the array and it appears to work.
I get the following back: {“key”:”e2c0be24560d78c5e599c2a9c9d0bbd2″,”product_id”:203,”variation_id”:0,”variation”:[],”quantity”:1,”data”:{},”data_hash”:”b5c1d5ca8bae6d4896cf1807cdf763f0″,”line_tax_data”:{“subtotal”:[],”total”:[]},”line_subtotal”:10,”line_subtotal_tax”:0,”line_total”:10,”line_tax”:0,”product_name”:”Test”,”product_title”:”Test”,”product_price”:”\u00a310.00″}Am I correct in thinking if I were to now call the following endpoint via GET
https://mydomain.com/wp-json/cocart/v1/get-cart?cart_key=e2c0be24560d78c5e599c2a9c9d0bbd2 I should retrieve the cart with the test item I have just added as this does not seem to work but I can’t see any cookies set either?What I am attempting to do is redirect away from the woocommerce site to external site that enables a product to be customised and then added to cart via your CoCart and then return the user to woocommerce for them to checkout normally.
Thanks
Chris
Forum: Plugins
In reply to: [Product Configurator for WooCommerce] choices.first is not a functionHi Marc,
Thought that might be the case.
I tried looking around to see where you were loading scripts but see you require $POST->id to be configurable otherwise you exit out hence it only works on product page.
Shortcode would be a great option where by you can just pass the post-id so the scripts are instantiated on any page and then you pass through product id to configure and add to cart.I’ve managed to ‘fudge’ it by linking directly to the specific product page then onload firing your .configurable-product-simple event which launches the configurator but would be great if we can remove this step.
It’s a really good plugin though, I’m just running the tests then will purchase the variable addon so I can alter pricing based on the configurations.
Cheers
Chris
Forum: Plugins
In reply to: [Product Configurator for WooCommerce] choices.first is not a functionHi Marc,
Is it possible if I know the product ID to initiate the configurator on a page other than the particular shop page with the product on?
I’m looking to be able to launch the configurator for a specific product on the home page of a WordPress / Woo Commerce install.
Many Thanks
Chris
Forum: Plugins
In reply to: [Product Configurator for WooCommerce] choices.first is not a functionOk – That fixed it!
Many Thanks
Chris