Skip to content

Commit 59dab42

Browse files
committed
Fix product_id backfill check to handle empty string meta values
1 parent 1e040ac commit 59dab42

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

includes/admin/class-product-section-selector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ private function sync_section_product_meta( int $post_id ): void {
500500
$product_id = (int) $product_terms[0]->term_id;
501501

502502
foreach ( $section_terms as $section ) {
503-
if ( 0 === (int) get_term_meta( $section->term_id, 'product_id', true ) ) {
503+
$existing_product_id = get_term_meta( $section->term_id, 'product_id', true );
504+
if ( '' === $existing_product_id ) {
504505
update_term_meta( $section->term_id, 'product_id', $product_id );
505506
}
506507
}

0 commit comments

Comments
 (0)