Merge pull request #4215 from scottbasgaard/master

"Order again" doesn't work. Proposed pass at fix.
This commit is contained in:
Mike Jolley 2013-11-27 06:27:39 -08:00
commit c05e369b43
4 changed files with 8 additions and 3 deletions

View File

@ -391,7 +391,7 @@ class WC_Form_Handler {
public function order_again() {
// Nothing to do
if ( ! isset( $_GET['order_again'] ) || ! is_user_logged_in() || ! WC()->verify_nonce( 'order_again', '_GET' ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-order_again' ) )
if ( ! isset( $_GET['order_again'] ) || ! is_user_logged_in() || ! wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-order_again' ) )
return;
// Clear current cart

View File

@ -231,6 +231,11 @@ if ( ! function_exists( 'meta_is_product_attribute' ) ) {
*/
function meta_is_product_attribute( $name, $value, $product_id ) {
$product = get_product( $product_id );
if ( $product->product_type != 'variation' ) {
return false;
}
$attributes = $product->get_variation_attributes();
var_dump($attributes[ $name ]);

View File

@ -1496,7 +1496,7 @@ if ( ! function_exists( 'woocommerce_order_again_button' ) ) {
?>
<p class="order-again">
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'order_again', $order->id ) ), 'woocommerce-order_again' ); ?>" class="button"><?php _e( 'Order Again', 'woocommerce' ); ?></a>
<a href="<?php echo wp_nonce_url( add_query_arg( 'order_again', $order->id ) , 'woocommerce-order_again' ); ?>" class="button"><?php _e( 'Order Again', 'woocommerce' ); ?></a>
</p>
<?php
}

View File

@ -680,7 +680,7 @@ final class WooCommerce {
* @return bool
*/
public function verify_nonce( $action, $method = '_POST', $error_message = false ) {
_deprecated_function( 'Woocommerce->verify_nonce', '2.1', 'WC_Nonce_Helper->verify_nonce' );
_deprecated_function( 'Woocommerce->verify_nonce', '2.1', 'wp_verify_nonce' );
return wp_verify_nonce( $$method[ '_wpnonce' ], 'woocommerce-' . $action );
}