Check for valid post type/products when setting up data
This commit is contained in:
parent
2bd40b29b2
commit
417651d579
|
@ -491,6 +491,9 @@ class WC_Shortcodes {
|
|||
|
||||
$product = wc_setup_product_data( $product_data );
|
||||
|
||||
if ( ! $product )
|
||||
return;
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<p class="product woocommerce" style="<?php echo $style; ?>">
|
||||
|
|
|
@ -464,7 +464,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
' . implode( '', $paypal_args_array) . '
|
||||
<!-- Button Fallback -->
|
||||
<div class="payment_buttons">
|
||||
<input type="submit" class="button alt" id="submit_paypal_payment_form" value="' . __( 'Pay via PayPal', 'woocommerce' ) . '" /> <a class="button cancel" href="'.esc_url( $order->get_cancel_order_url() ).'">'.__( 'Cancel order & restore cart', 'woocommerce' ).'</a>
|
||||
<input type="submit" class="button alt" id="submit_paypal_payment_form" value="' . __( 'Pay via PayPal', 'woocommerce' ) . '" /> <a class="button cancel" href="' . esc_url( $order->get_cancel_order_url() ) . '">'.__( 'Cancel order & restore cart', 'woocommerce' ).'</a>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(".payment_buttons").hide();
|
||||
|
|
|
@ -78,7 +78,7 @@ function wc_setup_product_data( $post ) {
|
|||
if ( is_int( $post ) )
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( $post->post_type !== 'product' && $post->post_type !== 'product_variation' )
|
||||
if ( empty( $post->post_type ) || ! in_array( $post->post_type, array( 'product', 'product_variation' ) ) )
|
||||
return;
|
||||
|
||||
$GLOBALS['product'] = get_product( $post );
|
||||
|
|
Loading…
Reference in New Issue