Skip to content

Commit badb135

Browse files
committed
Add 404 check when creating add to cart url for single products.
1 parent af59ab4 commit badb135

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

includes/class-wc-product-simple.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function add_to_cart_url() {
4545
array(
4646
'add-to-cart' => $this->get_id(),
4747
),
48-
function_exists( 'is_feed' ) && is_feed() ? $this->get_permalink() : ''
48+
( function_exists( 'is_feed' ) && is_feed() ) || ( function_exists( 'is_404' ) && is_404() ) ? $this->get_permalink() : ''
4949
)
5050
) : $this->get_permalink();
5151
return apply_filters( 'woocommerce_product_add_to_cart_url', $url, $this );

0 commit comments

Comments
 (0)