WC-Local-Pickup/woocommerce-local-pickup-time

Plugin Cart Processing Causing Failures for Other Shipping Methods

Closed this issue · 0 comments

Describe the bug

When Pickup Time is setup for a Local Pickup shipping method orders can't be submitted using a non-Local Pickup shipping method. The error "Expired or invalid submission!." is returned to the screen and prevents checkout. The following section of code processes the cart and is believed to be returning the error:

* Process the checkout.
*
* @since 1.3.0
*
* @return void
*/
public function field_process() {
$nonce = strval( wc_get_post_data_by_key( $this->get_order_pickup_time_nonce_key() ) );
if ( ! empty( $nonce ) && wp_verify_nonce( $nonce, $this->get_order_pickup_time_action_key() ) == 1 ) {
// Check if set, if its not set add an error.
if ( empty( wc_get_post_data_by_key( $this->get_order_post_key() ) ) ) {
wc_add_notice( __( 'Please select a pickup time.', 'woocommerce-local-pickup-time-select' ), 'error' );
}
} else {
wc_add_notice( __( 'Expired or invalid submission!.', 'woocommerce-local-pickup-time-select' ), 'error' );
}
}

Issue References:

Additional code to check:

https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/blob/develop/public/class-local-pickup-time.php#L897-L918

To Reproduce

Steps to reproduce the behavior:

  1. Go to a shop.
  2. Add an item to the cart.
  3. Proceed to checkout.
  4. Choose a non-Local Pickup shipping method.
  5. Click to Checkout.

Screenshots

image

Expected behavior

When checking out with a non-Local Pickup shipping method with Pickup Time enabled a customer should be able to successfully checkout.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce and this plugin are active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment