Different price

This topic contains 21 replies, has 2 voices, and was last updated by WCFM Forum WCFM Forum 2 weeks, 3 days ago.

  • Author
    Posts
  • #83044
    Avatar
    info100
    Participant

    Hello there
    I created two kinds of member plans.
    1) Plan type: One_time
    2) Plan type: FREE
    I would like to add an automatic price increase to the products they add using this code below.
    For both simple and variant products.

    function return_custom_price($price, $product) {
    global $post, $blog_id;
    $product = wc_get_product( $post_id );
    $post_id = $post->ID;
    $price = ($price*1.25);
    return $price;
    }
    add_filter (‘woocommerce_get_price’, ‘return_custom_price’, 10, 2);

  • #83337
    WCFM Forum
    WCFM Forum
    Keymaster

    OK, but what’t the problem? Code is not working?

  • #83775
    Avatar
    info100
    Participant

    Problem

    This code works for all added products.
    I just code this for store vendor free membership
    function return_custom_price ($ price, $ product) {
    global $ post, $ blog_id;
    $ product = wc_get_product ($ post_id);
    $ post_id = $ post-> ID;
    $ price = ($ price * 1.25);
    $ return price;
    }
    add_filter (‘woocommerce_get_price’, ‘return_custom_price’, 10, 2);

    store vendar one time for this code

    function return_custom_price ($ price, $ product) {
    global $ post, $ blog_id;
    $ product = wc_get_product ($ post_id);
    $ post_id = $ post-> ID;
    $ price = ($ price * 1.50);
    $ return price;
    }
    add_filter (‘woocommerce_get_price’, ‘return_custom_price’, 10, 2);

    I want to show.

    Different prices for both memberships

  • #83970
    WCFM Forum
    WCFM Forum
    Keymaster

    HI,

    $ post_id = $ post-> ID;
    $ price = ($ price * 1.50);

    – Yo have to change here, fetch product’s vendor id. Vendor’s membership and then get commission for that membership.

    Thank You

  • #84042
    Avatar
    info100
    Participant

    I don’t know how to do this.
    Can you give me an example?

    Vendor id: 47
    membership: one_time

    Can I just set it as a membership?

  • #84428
    WCFM Forum
    WCFM Forum
    Keymaster

    HI,

    Please use this revised code –

    function return_custom_price( $price, $product ) {
    	global $WCFM, $WCFMmp, $post, $blog_id;
    	
    	$vendor_id = wcfm_get_vendor_id_by_post( $product->get_id() );
    	if( $vendor_id ) {
    		$commisson_rule = $WCFMmp->wcfmmp_product->wcfmmp_get_product_commission_rule( $product->get_id() );
    		if( !empty( $commisson_rule ) && is_array( $commisson_rule ) && isset( $commisson_rule['percent'] ) ) {
    			$price += ( $price * ((float)$commisson_rule['percent']/100) );
    		}
    	}
    	return $price;
    }
    add_filter( 'woocommerce_product_get_price', 'return_custom_price', 10, 2 );

    Thank You

  • #84757
    Avatar
    info100
    Participant

    Hello there
    my english is not very good so i may not be able to tell.
    I’m sorry for that.
    But I can’t solve my problem, and it’s urgent.
    I have two vendor memberships, one is “one_time” and the other is “free”

    I would like to automatically multiply the product price by 1.5 when one_time adds a sale price to a member product.

    When I add a free membership product, I want it to multiply the sales price by 1.25 and offer the sale price with the new price in the store.

  • #84774
    Avatar
    info100
    Participant

    Please, this is very urgent.
    Submit a link if I’m going to make a payment.
    But paypal is not used in our country.

  • #84789
    Avatar
    info100
    Participant

    function return_custom_price( $price, $product ) {
    global $WCFM, $WCFMmp, $post, $blog_id;

    $vendor_id = wcfm_get_vendor_id_by_post( $product->get_id() );
    if ( vendor_user(‘subscription_type_one_time’) ) {
    $ price = ($ price * 1.50);
    $ return price;
    }
    add_filter (‘woocommerce_get_price’, ‘return_custom_price’, 10, 2);

    is it possible

  • #84933
    Avatar
    info100
    Participant

    thank you for not answering

  • #85652
    Avatar
    info100
    Participant
    This reply has been marked as private.
  • #86177
    WCFM Forum
    WCFM Forum
    Keymaster

    Hi,

    Really sorry for the delay. Actually, our site was down for few days due to upgradation.

    I would like to automatically multiply the product price by 1.5 when one_time adds a sale price to a member product.

    When I add a free membership product, I want it to multiply the sales price by 1.25 and offer the sale price with the new price in the store.

    – Do not change my code, just setup membership wise commission accordingly.

    Submit a link if I’m going to make a payment.
    – Don’t get this clearly.

  • #86829
    Avatar
    info100
    Participant
    This reply has been marked as private.
  • #86881
    Avatar
    info100
    Participant

    OK I did it.
    Thank you so much.
    well you are

  • #87104
    WCFM Forum
    WCFM Forum
    Keymaster

    Great .. thanks for the update 🙂

  • #87140
    Avatar
    info100
    Participant

    The code works very well. Thank you.
    But when I add a discount price, the normal only adds 50% to the discount price. Can we do this for both prices?

  • #87511
    WCFM Forum
    WCFM Forum
    Keymaster

    Hi,

    Sorry, not getting this clearly.

    Commission Setting – https://ibb.co/bd6jT3j
    I have created discounted product – https://ibb.co/R9t2d4G
    It’s showing product cost perfectly – https://ibb.co/CKn6gtB

    Thank You

  • #91287
    Avatar
    info100
    Participant

    https://ibb.co/CKn6gtB

    Hello there
    As shown in the picture, the price of $ 100 remains the same.
    The discount price is increasing.
    But this time it seems that only $ 1 discount has been made.
    It is true that both increase.
    Can you give me a code to edit this?

  • #91901
    WCFM Forum
    WCFM Forum
    Keymaster

    Sorry, may be I am not getting your requirement clearly.

    For creating this product I have added product’s regular price and sale price – https://ibb.co/R9t2d4G

    You may add anything as per your requirement. There is no such rule to set “only $ 1 discount ” always!

    Thank You

  • #91968
    Avatar
    info100
    Participant

    Hello there
    My English is not very good.
    Sale price: $ 100
    Discount price: $ 90
    In the code you provide, only the discounted price increases by 10%.

    false
    Sale price: $ 100
    Discount price: $ 99

    Sales price: $ 110
    Discount price: $ 99
    true

  • #92293
    Avatar
    info100
    Participant

    I am waiting answer.

  • #93377
    WCFM Forum
    WCFM Forum
    Keymaster

    Well, products has two prices – Regular Price and Sales Price.

    Now, what you referring here as “Discount Price”?

You must be logged in to reply to this topic.