• Resolved pxeffect

    (@pxeffect)


    Hi,

    I am using SliceWP for affiliates and linking the affiliate to a coupon so that when the customer users the affiliate link they get a discount as well – i.e. an incentive to use the link.

    On my home page (https://focusednotion.me) I am getting the product price $productObj->get_price_html();.

    However when someone uses an Affiliate link I want to show them the discounted rate from the associated coupon and not the standard product price.

    So my question is how do I look up the associate coupon details so that I can figure out the new price as as result of applying the coupon?

    Thanks.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @pxeffect,

    Thank you for reaching out! To grab an affiliate’s linked coupons, you can use the slicewp_get_affiliate_coupons( $affiliate_id ) function.

    You will have to provide the ID of the affiliate and the function will return an array with all linked coupons, containing specific data about the coupon.

    Thank you and best wishes,

    Mihai

    Thread Starter pxeffect

    (@pxeffect)

    Hi Mihai,

    Thanks for the reply, I took at look at the plugin functions.php file and that was the function I ended up using, so good to know I am on the same track.

    I couldn’t figure out how to get the affiliate ID from a custom slug, so wrote a custom query to do the lookup on the wp_slicewp_affiliate_meta table.

    Thanks for your help

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @pxeffect,

    No worries whatsoever! Happy I could help you out!

    Also, to grab the affiliate object using the slug you can use this function: slicewp_get_affiliate_by_custom_slug( $custom_slug )

    The function will return either “null” or a SliceWP_Affiliate object if the affiliate is found. To grab the affiliate ID from the affiliate object you can do the following:

    $affiliate = slicewp_get_affiliate_by_custom_slug( 'custom_slug' );
    $affiliate_id = ( ! is_null( $affiliate ) ? $affiliate->get( 'id' ) : 0 );

    Hope this helps!

    Best wishes,

    Mihai

    Thread Starter pxeffect

    (@pxeffect)

    Oh thanks, I was looking for a function to do that but couldn’t find one… I will switch to that instead!

    Thanks for your help Mihai.

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @pxeffect,

    Glad I could help you out!

    Wishing you a great rest of the week!

    Mihai

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