• Resolved amwebch

    (@amwebch)


    Hi,

    Would it be possible to add support for the YITH WooCommerce Points and Rewards plugin?

    I managed to insert the following into class-wcnotifications-instance.php:

    $earned_points = $this->object->get_meta('ywpar_points_from_cart');
    $total_points = '[yith_ywpar_points label="Total points: " show_worth="no"]';
    $this->placeholders['{yith_points}'] = 'Received points: '.$earned_points.''.$total_points;

    It works, but the shortcode [yith_ywpar_points] sometimes returns unexpected results: in some cases, it did simply not print on the receipt, and in one case it even returned a completely wrong total value (e.g. customer had earned 3 points during his order, the first points he earned, and the total was showing 29 points, and when I printed the receipt again it was displaying 25 points).

    Thank you in advance for your help.

    Regards,
    Aron

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Georgi Bakalski

    (@irdroid)

    This feature isn’t supported yet , neither in the free nor the pro versions

    Thread Starter amwebch

    (@amwebch)

    Hi Georgi,

    Thank you for your reply.

    Is there any chance to add this as a feature request? Or having a quote for custom development (if you provide this service)?

    Thank you and have a nice day.

    Regards,
    Aron

    Thread Starter amwebch

    (@amwebch)

    As a side note (maybe it can be useful for other users, or maybe you can refine it and insert it in a future release), I now seem to have found a better way to display points, retrieving the customer ID from the order and fetching the points from that value, as follows:

    $earned_points = $this->object->get_meta('ywpar_points_from_cart');
    $order_customer_id = $this->object->get_customer_id();
    $c = ywpar_get_customer( $order_customer_id );
    $new_total_points = (int)$c->get_usable_points();
    $this->placeholders['{yith_points}'] = 'Earned points: '.$earned_points.'<br/>Total points: '.$new_total_points

    It is not perfect (e.g. it does not check if the YITH plugin is active, and texts cannot be translated), but at least it seems to work correctly.

    Regards,
    Aron

    Plugin Author Georgi Bakalski

    (@irdroid)

    Great! Thanks for contributing Aron!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Support for YITH WooCommerce Points and Rewards’ is closed to new replies.