Skip to content

Commit 307c964

Browse files
committed
PLUGINS-6339 The zero-price case in the product card markup has been fixed
1 parent 034641d commit 307c964

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

includes/shortcodes/class-ecwid-shortcode-product.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,21 @@ public function render_placeholder() {
6666

6767
$product = Ecwid_Product::get_without_loading( $this->_params['id'], (object) array( 'name' => '' ) );
6868

69+
if ( ! empty ( $product->price ) ) {
70+
$price = $product->price;
71+
} else {
72+
$price = 0;
73+
}
74+
6975
if ( is_array( $items ) && count( $items ) > 0 ) {
7076
foreach ( $items as $item ) {
7177
if ( array_key_exists( $item, $display_items ) ) {
7278
if ( $item == 'title' ) {
7379
$display_items[ $item ] = str_replace( '$name', $product->name, $display_items[ $item ] );
7480
}
7581

76-
if ( $item == 'price' && ! empty( $product->price ) ) {
77-
$display_items[ $item ] = str_replace( '$price', $product->price, $display_items[ $item ] );
82+
if ( $item == 'price' ) {
83+
$display_items[ $item ] = str_replace( '$price', $price, $display_items[ $item ] );
7884
}
7985

8086
if ( $this->_params['link'] == 'yes' && in_array( $item, array( 'title', 'picture' ) ) ) {

0 commit comments

Comments
 (0)