Forum Replies Created

Viewing 15 replies - 1 through 15 (of 36 total)
  • Thread Starter houssem12

    (@houssem12)

    how i can do that please

    Thread Starter houssem12

    (@houssem12)

    what about plugin ELEX WooCommerce Google Shopping (Google Product Feed)

    Thread Starter houssem12

    (@houssem12)

    HI MEMBERS AND THANKS FOR HELPING ME
    AFTER CREATING A PRODUCT $objProduct = new WC_Product_Variable();
    AND WHEN I CREAT THE PRODUCT REGULAR PRICE $objProduct->set_regular_price(10);
    THE PRICE NOT SET I DON’T KNOW WHY DIDNT WORK FOR ME AND I THINK BECAUSE ITS A VARIABLE PRODUCT NOT A SIMPLE PRODUCT
    PLEASE HELP

    Thread Starter houssem12

    (@houssem12)

    Mirko P. (@rainfallnixfig) THANKS A LOT EVERYTHING WORK FINE AND PERFECT

    Thread Starter houssem12

    (@houssem12)

    Mirko P. (@rainfallnixfig) thanks for helping me out and when i export not all product exported
    i’ve test it and i created a small desktop apps that test all the thing and i take a product from the sql database that we have and test if not exist in csv file the first product i take it and not exist in that file and i see in the website its (exist) so that mean not all product is being exported please any idea for that and please help me

    Thread Starter houssem12

    (@houssem12)

    thanks for helping me out and i have a code that work on local website and update all price perfectly thats what i need exactly and not on the published website it shutdown completly

    function create_product_variation( $product_id, $variation_data ){
        // Get the Variable product object (parent)
        $product = wc_get_product($product_id);
    
        $variation_post = array(
            'post_title'  => $product->get_name(),
            'post_name'   => 'product-'.$product_id.'-variation',
            'post_status' => 'publish',
            'post_parent' => $product_id,
            'post_type'   => 'product_variation',
            'guid'        => $product->get_permalink()
        );
    
        // Creating the product variation
        $variation_id = wp_insert_post( $variation_post );
    
        // Get an instance of the WC_Product_Variation object
        $variation = new WC_Product_Variation( $variation_id );
    
        // Iterating through the variations attributes
        foreach ($variation_data['attributes'] as $attribute => $term_name )
        {
            $taxonomy = 'pa_'.$attribute; // The attribute taxonomy
    
            // If taxonomy doesn't exists we create it (Thanks to Carl F. Corneil)
            if( ! taxonomy_exists( $taxonomy ) ){
                register_taxonomy(
                    $taxonomy,
                   'product_variation',
                    array(
                        'hierarchical' => false,
                        'label' => ucfirst( $attribute ),
                        'query_var' => true,
                        'rewrite' => array( 'slug' => sanitize_title($attribute) ), // The base slug
                    ),
                );
            }
    
            // Check if the Term name exist and if not we create it.
            if( ! term_exists( $term_name, $taxonomy ) )
                wp_insert_term( $term_name, $taxonomy ); // Create the term
    
            $term_slug = get_term_by('name', $term_name, $taxonomy )->slug; // Get the term slug
    
            // Get the post Terms names from the parent variable product.
            $post_term_names =  wp_get_post_terms( $product_id, $taxonomy, array('fields' => 'names') );
    
            // Check if the post term exist and if not we set it in the parent variable product.
            if( ! in_array( $term_name, $post_term_names ) )
                wp_set_post_terms( $product_id, $term_name, $taxonomy, true );
    
            // Set/save the attribute data in the product variation
            update_post_meta( $variation_id, 'attribute_'.$taxonomy, $term_slug );
        }
    
        ## Set/save all other data
    
        // SKU
        if( ! empty( $variation_data['sku'] ) )
            $variation->set_sku( $variation_data['sku'] );
    
        // Prices
        if( empty( $variation_data['sale_price'] ) ){
            $variation->set_price( $variation_data['regular_price'] );
        } else {
            $variation->set_price( $variation_data['sale_price'] );
            $variation->set_sale_price( $variation_data['sale_price'] );
        }
        $variation->set_regular_price( $variation_data['regular_price'] );
    
        // Stock
        if( ! empty($variation_data['stock_qty']) ){
            $variation->set_stock_quantity( $variation_data['stock_qty'] );
            $variation->set_manage_stock(true);
            $variation->set_stock_status('');
        } else {
            $variation->set_manage_stock(false);
        }
        
        $variation->set_weight(''); // weight (reseting)
    
        $variation->save(); // Save the data
    }

    and to use it

    $parent_id = 746; // Or get the variable product id dynamically
    
    // The variation data
    $variation_data =  array(
        'attributes' => array(
            'size'  => 'M',
            'color' => 'Green',
        ),
        'sku'           => '',
        'regular_price' => '22.00',
        'sale_price'    => '',
        'stock_qty'     => 10,
    );
    
    // The function to be run
    create_product_variation( $parent_id, $variation_data );

    i need to fix the error in this code please help

    Thread Starter houssem12

    (@houssem12)

    i want export all product just the name of product to a textfile
    please help me

    Thread Starter houssem12

    (@houssem12)

    thanks for helping me and i think the easiest way is to export all product to a text file after i will creat a small desktop app that test the difference
    please help

    Thread Starter houssem12

    (@houssem12)

    not resolved yet
    i need to update all product with the same price
    the product type is a variable product
    and i think it should have an attribute first so i need to add to all product an attribute and than update the price
    please help

    Thread Starter houssem12

    (@houssem12)

    number of products are about 23000 so its impossible to test one by one it will take forever.
    please help

    Thread Starter houssem12

    (@houssem12)

    also i tried a function to update all product and not work

    function return_custom_price($price, $product) {
        global $post, $blog_id;
        $product = wc_get_product( $post_id );
        $post_id = $post->ID;
        $price = (2.5);
        return $price;
    }
    add_filter('woocommerce_get_price', 'return_custom_price', 10, 2);
    Thread Starter houssem12

    (@houssem12)

    thanks for your reply but i want advanced customization
    and those for grid layout not for list layout
    please help me if any idea how change the code in woocommerce archive page
    using code
    please help me this will save my life

    Thread Starter houssem12

    (@houssem12)

    i want add a labels and textbox field and an upload text file to the plugin interface
    please help to manage to add that

    <!DOCTYPE HTML>
    <html>
    
    <head>
    	<title>text</title>
    </head>
    
    <body>
    	<form action="#" method="POST" enctype="multipart/form-data">
    	Choisir votre categorie 
    	<input type="text" name="categorie">
    	<br>
    		<input type="file" name="text">
    		<input type="submit" name="submit">
    	</form>
    	</body>
    
    </html>

    after i want execute this in php code

    Thread Starter houssem12

    (@houssem12)

    thank you a lot thanks very much and i have another question i want develop a plugin and i am beginner for this so i want shortcut some of my way
    i want add the 1st interface to my plugin like html/css how i can do that?
    please help

    Thread Starter houssem12

    (@houssem12)

    thanks for helping me and i can’t hire a developper for now
    and i’am already a developper i just not familiarised with wordpress and specialy woocommerce
    i would know how the product is constructed using html and css and php and i will make everything after perhaps
    please help me

Viewing 15 replies - 1 through 15 (of 36 total)