Fixed add to cart link for simple products on feed
This commit is contained in:
parent
1e0ff37d70
commit
282d6073ff
|
@ -39,8 +39,15 @@ class WC_Product_Simple extends WC_Product {
|
|||
* @return string
|
||||
*/
|
||||
public function add_to_cart_url() {
|
||||
$url = $this->is_purchasable() && $this->is_in_stock() ? remove_query_arg( 'added-to-cart', add_query_arg( 'add-to-cart', $this->id ) ) : get_permalink( $this->id );
|
||||
|
||||
$url = $this->is_purchasable() && $this->is_in_stock() ? remove_query_arg(
|
||||
'added-to-cart',
|
||||
add_query_arg(
|
||||
array(
|
||||
'add-to-cart' => $this->get_id(),
|
||||
),
|
||||
function_exists( 'is_feed' ) && is_feed() ? $this->get_permalink() : ''
|
||||
)
|
||||
) : $this->get_permalink();
|
||||
return apply_filters( 'woocommerce_product_add_to_cart_url', $url, $this );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue