Merge pull request #20138 from woocommerce/fix/20133

Use GET in external product form
This commit is contained in:
Mike Jolley 2018-05-21 17:36:51 +01:00 committed by GitHub
commit 231c8da566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -17,12 +17,21 @@
defined( 'ABSPATH' ) || exit;
$product_url_parts = wp_parse_url( $product_url );
$query_string = array();
if ( ! empty( $product_url_parts['query'] ) ) {
parse_str( $product_url_parts['query'], $query_string );
}
do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<form class="cart" action="<?php echo esc_url( $product_url ); ?>" method="post">
<form class="cart" action="<?php echo esc_url( $product_url ); ?>" method="get">
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
<button type="submit" name="add-to-cart" class="single_add_to_cart_button button alt"><?php echo esc_html( $button_text ); ?></button>
<button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $button_text ); ?></button>
<?php wc_query_string_form_fields( $query_string ); ?>
<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
</form>