Skip to content

Commit

Permalink
refactor: Product meta processor method for gallery image restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
devAsadNur committed Dec 20, 2024
1 parent 0ecb790 commit 1c36c1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/wc-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function dokan_process_product_meta( int $post_id, array $data = [] ) {

// Gallery Images
if ( isset( $data['gallery_image_ids'] ) ) {
$data = apply_filters( 'dokan_restrict_product_gallery_images_on_edit', wp_unslash( $data['gallery_image_ids'] ) );
$attachment_ids = apply_filters( 'dokan_restrict_product_gallery_images_on_edit', wp_unslash( $data['gallery_image_ids'] ) );
$attachment_ids_arr = array_filter( explode( ',', wc_clean( $attachment_ids ) ) );

$attachment_ids = array_filter( explode( ',', wc_clean( $data ) ) );
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids_arr ) );
}

// Check product visibility and purchase note
Expand Down

0 comments on commit 1c36c1c

Please sign in to comment.