Support » Requests and Feedback » product pictures consume database

  • Hi All,

    Im facing quite serious issue, I have turned on the integration with external wholesaler, products are imported to the woocomrce in the daily basis, when the product is not available on the supplier stock, then it is deleted on the woocommerce site. Never the lest the products and pictures are imported to the store database, and its consume space. The hosting it self has 250GB and the database has only 1GB. Any idea how to reconfigure the Woocommrce that it will be saving the product information and data to the hosting space and not in to data base ?

    I try some custome code for “// Disable product image attachment to database”

    but still the products and pictures are saved to the database and consume precious space 🙁

    Any idea how to solve this issue??

    code:

    // Disable product image attachment to database
    remove_action(‘woocommerce_process_product_meta’, ‘woocommerce_process_product_meta_save’, 10, 2);

    // Save product image to server
    add_action(‘woocommerce_process_product_meta’, ‘save_product_image_to_server’, 10, 2);
    function save_product_image_to_server($post_id, $post) {
    if (isset($_FILES[‘image’])) {
    $file = $_FILES[‘image’];
    $upload = wp_upload_bits($file[‘name’], null, file_get_contents($file[‘tmp_name’]));
    if (isset($upload[‘error’]) && $upload[‘error’] != 0) {
    wp_die(‘There was an error uploading your file. The error is: ‘ . $upload[‘error’]);
    } else {
    update_post_meta($post_id, ‘_product_image’, $upload);
    }
    }
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.