• Resolved alocin-deu

    (@alocin-deu)


    hi,

    2 questions:

    1- I can not disable sidebar, i tryed from backoffice to uncheck, but does not work.

    2- Is it possible to set a default category when a vendor upload a new product?
    I used this code to auto create a product when a vendor create an account, and it is working, but no category is assegned to the product:

    add_action( ‘wcfmmp_new_store_created’, function( $member_id, $wcfmmp_settings ) {
    $product_args = array(
    ‘post_title’ => ‘Donacion’,
    ‘post_status’ => ‘publish’,
    ‘post_type’ => ‘product’,
    ‘post_author’ => $member_id,
    ‘post_name’ => sanitize_title(‘Donacion’)
    );
    $new_product_id = wp_insert_post( $product_args, true );
    update_post_meta( $new_product_id, ‘_wcfm_product_author’, $member_id );

    // Set Product Type
    wp_set_object_terms( $new_product_id, ‘simple’, ‘product_type’ );

    // Set Price
    update_post_meta( $new_product_id, ‘_regular_price’, ’10’ );
    update_post_meta( $new_product_id, ‘_price’, ’10’ );
    }, 50, 2 );

    Thanks a lot your plugin Rock !!!

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter alocin-deu

    (@alocin-deu)

    One thing more:

    3- When vendor signu up and the auto product is generate, it works just for first language English…the second lanuage spanish ( i use WPML) does not create the product.

    Is it possible the creation in both language?
    thanks

    Plugin Author WC Lovers

    (@wclovers)

    HI,

    1- I can not disable sidebar, i tryed from backoffice to uncheck, but does not work.

    – Which sidebar you want to disable?

    2- Is it possible to set a default category when a vendor upload a new product?

    – Your code is wrong, that’s related to when new store created, not new product.
    Between, do you want add default category same for all vendors or differently for each vendors?

    Is this default category will be associated with product if vendors do not add any categories, or always it will be associated?

    3- When vendor signu up and the auto product is generate, it works just for first language English…the second lanuage spanish ( i use WPML) does not create the product.

    – How you are generating “auto product” for English version?

    You have to generate translated product for that English product as well.

    Thank You

    Thread Starter alocin-deu

    (@alocin-deu)

    hi, thanks for the help ??

    1- from the single store page, for example here: https://adoptahost.com/store/hotel-uno/

    2- sorry you are right, i try to explain better, i would like to have:

    When a vendor signup for the 1st time and create store vendore is possible to auto create a default product of 10 euro of a specific category called ‘donation’.

    Default category same for all vendors.

    And this i need works if a vendor signup in english or spanish version.

    3- Maybe this question is related to the question 2.( i need the autoproduct create in spanish and english too) because now with my code this happend just in english version, but maybe my code is wrong.

    thansk a lot
    nico

    • This reply was modified 4 years, 10 months ago by alocin-deu.
    Plugin Author WC Lovers

    (@wclovers)

    Hi,

    1- from the single store page, for example here: https://adoptahost.com/store/hotel-uno/

    – Well, there has setting for this under WCFM Admin Setting -> Marketplace Setting – Disable “Store Sidebar” – https://ibb.co/s9jyGpr

    2- sorry you are right, i try to explain better, i would like to have:

    When a vendor signup for the 1st time and create store vendore is possible to auto create a default product of 10 euro of a specific category called ‘donation’.

    Default category same for all vendors.

    And this i need works if a vendor signup in english or spanish version.

    – OK, possible. Create two such products as Admin, set visibility “Private”. Know me those two products ids. I will give a snippet which will clone those two products and add to vendor’s store on first time registration.

    Thank You

    Thread Starter alocin-deu

    (@alocin-deu)

    thanks, ok:

    1 question- SIDEBAR: check doesn’t work, i disable and nothing change

    2 question- Default product:

    1st product, english: id 3655
    2nd product, spanish: id 3656

    i thinks this is all, any more info let me know.
    regards
    Nicola

    Plugin Author WC Lovers

    (@wclovers)

    HI,

    Which theme you are using for the site?

    For product creating use this code –

    add_action( 'wcfmmp_new_store_created', function( $member_id, $wcfmmp_settings ) {
    		
    	if( !class_exists( 'WC_Admin_Duplicate_Product' ) ) {
    		include( WC_ABSPATH . 'includes/admin/class-wc-admin-duplicate-product.php' );
    	}
    	$WC_Admin_Duplicate_Product = new WC_Admin_Duplicate_Product();
    	
    	$product_list = array( 3655, 3656 );
    	
    	foreach( $product_list as $product_id ) {
    
    		$product = wc_get_product( $product_id );
    	
    		if ( false === $product ) {
    			/* translators: %s: product id */
    			//echo '{"status": false, "message": "' . sprintf( __( 'Product creation failed, could not find original product: %s', 'woocommerce' ), $product_id ) . '" }';
    			continue;
    		}
    	
    		$duplicate = $WC_Admin_Duplicate_Product->product_duplicate( $product );
    		
    		update_post_meta( $duplicate->get_id(), '_wcfm_product_views', 0 );
    		delete_post_meta( $duplicate->get_id(), '_wcfm_review_product_notified' );
    		
    		$update_product = array(
    													'ID'           => $duplicate->get_id(),
    													'post_status'  => 'publish',
    													'post_type'    => 'product',
    													'post_author'  => $member_id,
    												);
    		wp_update_post( $update_product, true );	
    	
    		// Hook rename to match other woocommerce_product_* hooks, and to move away from depending on a response from the wp_posts table.
    		do_action( 'woocommerce_product_duplicate', $duplicate, $product );
    		do_action( 'after_wcfm_product_duplicate', $duplicate->get_id(), $product );
    			
    		update_post_meta( $duplicate->get_id(), '_wcfm_product_author', $member_id );
    	}
    	
    }, 50, 2 );

    Add custom code(s) to your child theme’s functions.php
    In case you do not have child theme then add those using this plugin –?https://www.ads-software.com/plugins/code-snippets/

    Thank you

    Thread Starter alocin-deu

    (@alocin-deu)

    thanks a lot it work perfect!

    about theme i am using Avada

    regards
    Nicola

    Plugin Author WC Lovers

    (@wclovers)

    That’s great, thanks for the update ??

    1 question- SIDEBAR: check doesn’t work, i disable and nothing change

    – Are you using default store template, or created own template using “Elementor”?

    If it’s default template then be sure WCFM Admin Setting -> Marketplace Setting – Store Sidebar checkbox is “unchecked” – https://ibb.co/tzKxP8F

    Thank You

    Thread Starter alocin-deu

    (@alocin-deu)

    Hi,

    i am using default tempalte.
    no elementor plugin installed.
    it is disabled like you show to me..but still there the sidebar in product page.

    thanks
    nicola

    Plugin Author WC Lovers

    (@wclovers)

    Please show me store page screenshot or share a store page url with me to check.

    Possibly, it’s theme default sidebar!

    Thank you

    Thread Starter alocin-deu

    (@alocin-deu)

    here the link of a vendor for example:

    https://adoptahost.com/store/hostal-girona/

    about sidebar theme i think is disbaled also.

    thansk a lot for the support

    Plugin Author WC Lovers

    (@wclovers)

    Hi,

    Thanks, it’s store page default sidebar.

    be sure WCFM Admin Setting -> Marketplace Setting – Store Sidebar checkbox is “unchecked” – https://ibb.co/tzKxP8F

    – It should disable if you uncheck this checkbox.

    Hope you didn’t do any template override yet!

    Between, is there any caching for site? If so, please clear those and check once.

    If still not working then add this line to your site and check once –

    add_filter( 'wcfmmp_is_store_sidebar', '__return_false' );

    Add custom code(s) to your child theme’s functions.php
    In case you do not have child theme then add those using this plugin –?https://www.ads-software.com/plugins/code-snippets/

    Thank You

    Thread Starter alocin-deu

    (@alocin-deu)

    hi, thansk a lot !

    no template added.
    no elementor.
    checkbox is uncheck.

    your code work perfect !!!solved it ??

    regards

    Plugin Author WC Lovers

    (@wclovers)

    Glad to here it!

    You are always welcome ??

    If you get a chance then please leave a review for me.

    Have a great day.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Sidebar and Default Category’ is closed to new replies.