Hello Tejas you may please alter your code below and let me know if it worked for you .
foreach ($files['name'] as $key => $value) {
$file = array(
'name' => $files['name'][$key],
'type' => $files['type'][$key],
'tmp_name' => $files['tmp_name'][$key],
'error' => $files['error'][$key],
'size' => $files['size'][$key]
);
$_FILES = array ("files" => $file);
foreach ($_FILES as $file => $array) {
$newupload = my_handle_attachment($file,$post_id);
}
array_push($gallery,$newupload);
}
update_post_meta($post_id,'_product_image_gallery', implode(',',$gallery));
Related Posts:
- WooCommerce conditional meta query
- How to add multiple product gallery images from front-end
- WooCommerce: Adding Order Item Meta Data That’s Hidden
- Target WooCommerce Product Gallery Image (rather than Featured Image) for og:image
- WP_Query with meta_query for children
- How to update custom field in WooCommerce
- Set default value field meta_Value [closed]
- update_post_meta not work [closed]
- WooCommerce order refund get qty refunded
- WooCommerce Bookings Plugin Not Saving Order ID
- Conditionally run function based on custom meta value?
- Next/Previous Product with custom order by price & products inside the product category [closed]
- How to add custom checkboxes from loop to WooCommerce product variation options?
- How to save a Woocomerce metabox input as a metadata field
- Can’t update WooCommerce payment method title
- Add class to latest item Woocommerce
- show multiple product photos on WooCommerce single page
- Update Custom Post Meta Even if Draft
- How to programatically create a WooCommerce downloadable product?
- How do I change the woocommerce product gallery to show all thumbnails instead of three at a time in a carousel?
- WooCommerce wp_insert_post action firing on every save
- Updating order meta to have a meta entry from an item in the order
- acf_form() – “On Update” action [closed]
- Woocommerce – Add a product to cart programmatically via JS or PHP [closed]
- How to update custom fields using the wp_insert_post() function?
- ( Woocommerce) How to get the user belonging to an order? [closed]
- Get the product list of a given Category ID
- How do I delete all UNUSED images from my uploads directory?
- Attaching taxonomy data to post with wp_insert_post
- List of JS events in the WooCommerce frontend
- get woocommerce My account page link
- WooCommerce: How to edit the get_price_html
- Get woocommerce product price by id [closed]
- Product categories don’t appear as option to build menu
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- WooCommerce Variable Product Price not showing on single product page
- What is “meta_input” parameter in wp_insert_post() used for?
- How to override WooCommerce template files?
- Woocommerce add extra field to variation product
- Getting the gallery images from products in woocommerce?
- How to get current product category ID in product archive page
- Get url of product’s images (woocommerce)
- WooCommerce prices location in DB
- What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
- Order by rating not works in wp_query
- Woocommerce: How to remove page-title at the home/shop page but not category pages
- Woocommerce show cross sells on singe product page [closed]
- How to add a new endpoint in woocommerce
- Are there any hook or filter when refund is done through admin -woocommerce
- How to check if is in cart page? [closed]
- Display single product attribute value on Shop page (Woocommerce)
- WP/WooCommerce REST API cart/checkout/order [closed]
- how to use wc_create_order with subscription product
- WooCommerce: Webhook disabled on its own
- What is the code to get the download link for a product in WooCommerce?
- Share users and WooCommerce memberships between two installations
- advanced custom fields update_field for field type: Taxonomy
- Slow Loading Attribute Select – WooCommerce Backend
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- How to change or add Woocommerce thank you page URL key content?
- How can I define a custom template for woocommerce [products] shortcode? [closed]
- How to remove an action within a class with extends
- single-product.php template not working for single products [closed]
- Insert variations via woocommerce api [closed]
- WooCommerce get physical store address
- Is it possible to add custom fields to a WooCommerce attribute term? [closed]
- wc_get_template_part( ‘content’, ‘product’ ) | Where is this file located?
- how to get woocommerce product attribute slug
- Correct function to get the user’s latest Woocommerce Subscription?
- Move payment options at checkout in WooCommerce [closed]
- add_filter to modify woocommerce_cart_item_name hyperlink
- Where do the cart details are stored in database?
- How to display product price of the product in loop
- How to get the first image gallery of a product in woocommerce in a loop
- How to disable Woocommerce password recovery and use the default WordPress password reset page?
- Display order items names in WooCommerce admin orders list [closed]
- Is it safe to delete from db orphaned posts i.e. whose post_parent no longer exists?
- Add custom variable to cart content [closed]
- Get product details by url key in WordPress woocommerce
- Get product link
- WooCommerce – Hook after Loading Variation in Admin Edit page?
- How to delete woo commerce order pragmatically? [closed]
- WooCommerce changes lost password reset link
- Process checkout using WC REST API
- How to get rid of the hover zoom in WooCommerce single products
- How do I display certain products via their category on a section of a page using PHP?
- How to turn off WooCommerce user registration and manually create accounts?
- What’s the difference between WC() and $woocommerce
- Display orders instead of woocommerce my account dashboard for logged in users [closed]
- Limit users to one active subscription in WooCommerce Subscriptions? [closed]
- Detect whether a page is a product subcategory page?
- Hidden woocommerce products still showing up in search results [closed]
- Menu not show woocommerce product category
- Orders being sent to wrong admin email in WooCommerce [closed]
- PHP/Manual use of images? – 2 Questions
- WooCommerce: add different order item meta for each item in order
- Remember page before login page, redirect to that page after login
- Woocommerce 3.1 Add product image to order confirmation email not working
- wp_insert_post() getting slower the more posts
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?