Merge pull request #10022 from WPprodigy/shortcode-fix
Check for a valid product ID/SKU in the add_to_cart shortcodes
This commit is contained in:
commit
3b6de6051a
|
@ -446,9 +446,9 @@ class WC_Shortcodes {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( is_object( $product_data ) ) {
|
||||||
$product = wc_setup_product_data( $product_data );
|
$product = wc_setup_product_data( $product_data );
|
||||||
|
} else {
|
||||||
if ( ! $product ) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,6 +494,12 @@ class WC_Shortcodes {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( is_object( $product_data ) ) {
|
||||||
|
$product = wc_setup_product_data( $product_data );
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'product' !== $product_data->post_type ) {
|
if ( 'product' !== $product_data->post_type ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue