Conversation
supportI just installed your plugin and this is the first time I tried using it. I cloned an order and it seemed to work. When my customer tried paying, he kept telling me it didn’t work. Here is the status I received: Square Payment Failed (Status code BAD_REQUEST: The order is already paid.) Order status changed from Pending payment to Failed. Any fix for this? Thanks, Allen
Hi Allen Square probably creates some hidden meta fields with each order that our plugin is copying across and this confuses it. I’ve had a look at the Square plugin and can see it creates a few meta fields for each order. We can get this fixed permanently in the next release of the plugin, but for now, you can try adding this code to your site – add it in your theme functions.php file or add it as a code snippet. /** * Exclude WooCommerce Square payment meta from cloned orders. */ add_filter( 'cdo_wc_clone_order_ignore_meta_keys', function( $keys, $order_id, $order ) { $square_meta = []; foreach ( $order->get_meta_data() as $meta ) { if ( str_starts_with( $meta->key, '_wc_square_' ) ) { $square_meta[] = $meta->key; } } return array_unique( array_merge( $keys, $square_meta ) ); }, 10, 3 ); What this code does is look for any meta fields that match the pattern _wc_square_* pattern and then excludes them from the clone function. Once you add the code, clone the order again and this time the customer should be able to pay without issue. If this doesn’t solve it please supply your list of installed plugins (we’re assuming you are using Square for WooCommerce – other plugins may need different code). Thanks
Hi Allen Just checking in to see if this resolved the issue?
@allenr I didnt hear from you so marking this issue resolved! Thanks!
Hi Allen Square probably creates some hidden meta fields with each order that our plugin is copying across and this confuses it. I’ve had a look at the Square plugin and can see it creates a few meta fields for each order. We can get this fixed permanently in the next release of the plugin, but for now, you can try adding this code to your site – add it in your theme functions.php file or add it as a code snippet. /** * Exclude WooCommerce Square payment meta from cloned orders. */ add_filter( 'cdo_wc_clone_order_ignore_meta_keys', function( $keys, $order_id, $order ) { $square_meta = []; foreach ( $order->get_meta_data() as $meta ) { if ( str_starts_with( $meta->key, '_wc_square_' ) ) { $square_meta[] = $meta->key; } } return array_unique( array_merge( $keys, $square_meta ) ); }, 10, 3 ); What this code does is look for any meta fields that match the pattern _wc_square_* pattern and then excludes them from the clone function. Once you add the code, clone the order again and this time the customer should be able to pay without issue. If this doesn’t solve it please supply your list of installed plugins (we’re assuming you are using Square for WooCommerce – other plugins may need different code). Thanks
Hi Allen Just checking in to see if this resolved the issue?
@allenr I didnt hear from you so marking this issue resolved! Thanks!