wp-graphql-woocommerce icon indicating copy to clipboard operation
wp-graphql-woocommerce copied to clipboard

mutation UpdateItemQuantities does not update the cart.

Open Vignesh-02 opened this issue 1 year ago • 3 comments

mutation udpateCartItemQuantities($items: [CartItemQuantityInput] = [{key: "053c837dca3a5636ad1c9bccd6af3415", quantity: 12}], $clientMutationId: String = "random") { updateItemQuantities( input: {items: $items, clientMutationId: $clientMutationId} ) { cart { contents { edges { node { key quantity product { node { image { link } } } total } } itemCount } contentsTotal contentsTax total discountTotal } } }

Even fillCart and removeItems do not work. They give 'internal server error' which in turn gives a 'woo transaction executed out of order' error. Please do fix this ASAP. The only way to avoid the Woo transaction error is to comment out the code at line 224 in class-session-transaction-manager.php

` public function pop_transaction_id() { // Bail if transaction not started. if ( is_null( $this->transaction_id ) ) { return; }

	// Get transaction queue.
	$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );

	// Throw if transaction ID not on top.
	if ( $this->transaction_id !== $transaction_queue[0]['transaction_id'] ) {

// throw new UserError( __( 'Woo session transaction executed out of order', 'wp-graphql-woocommerce' ) ); } else {

// // Remove Transaction ID and update queue. array_shift( $transaction_queue ); $this->save_transaction_queue( $transaction_queue ); $this->transaction_id = null; } } `

Vignesh-02 avatar Aug 13 '23 12:08 Vignesh-02

@Vignesh-02 It would appear you woo session token is not being configured correctly. Have you read through the docs on this subject?

kidunot89 avatar Aug 16 '23 18:08 kidunot89

@Vignesh-02 Have you gotten it working?

kidunot89 avatar Aug 23 '23 14:08 kidunot89

@kidunot89 It does not work for me, followed the docs (https://woographql.com/docs/configuring-graphql-client-for-user-session and https://woographql.com/docs/configuring-graphql-client-for-user-session) and got the same error using the mutation updateCustomer

YishaqG avatar Oct 25 '23 01:10 YishaqG