Skip to content

Commit

Permalink
Do not skip items even if $_product is set to an unexpected value (…
Browse files Browse the repository at this point in the history
…less strict/more tolerant).
  • Loading branch information
barryhughes committed Jan 9, 2025
1 parent c4035a0 commit 9ffa14a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions templates/myaccount/subscription-totals-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
'entity_type' => gettype( $_product ),
)
);
continue;
}

if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
Expand All @@ -51,7 +50,7 @@
<?php endif; ?>
<td class="product-name">
<?php
if ( $_product && ! $_product->is_visible() ) {
if ( is_a( $_product, WC_Product::class ) && ! $_product->is_visible() ) {
echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $item['name'], $item, false ) );
} else {
echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', sprintf( '<a href="%s">%s</a>', get_permalink( $item['product_id'] ), $item['name'] ), $item, false ) );
Expand Down Expand Up @@ -89,7 +88,8 @@
<?php
}

$purchase_note = $_product->get_purchase_note();
$purchase_note = is_a( $_product, WC_Product::class ) ? $_product->get_purchase_note() : false;

if ( $subscription->has_status( array( 'completed', 'processing' ) ) && $purchase_note ) {
?>
<tr class="product-purchase-note">
Expand Down

0 comments on commit 9ffa14a

Please sign in to comment.