wp-graphql / wp-graphql-woocommerce

Add WooCommerce support and functionality to your WPGraphQL server
https://woographql.com
GNU General Public License v3.0
648 stars 130 forks source link

mutation UpdateItemQuantities does not update the cart. #783

Open Vignesh-02 opened 1 year ago

Vignesh-02 commented 1 year ago

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; } } `

kidunot89 commented 1 year ago

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

kidunot89 commented 1 year ago

@Vignesh-02 Have you gotten it working?

YishaqG commented 1 year ago

@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