Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User →
- Make sure your
Local by FlyWheel
WordPress install is a custom install
class My_Custom_My_Account_Endpoint { | |
/** | |
* Custom endpoint name. | |
* | |
* @var string | |
*/ | |
public static $endpoint = 'my-custom-endpoint'; | |
/** |
/** | |
* Pay Sale Profit on Completed or Shipped Orders | |
* @version 1.0 | |
*/ | |
add_action( 'woocommerce_order_status_completed', 'mycred_pro_pay_profit_from_sale' ); | |
add_action( 'woocommerce_order_status_shipped', 'mycred_pro_pay_profit_from_sale' ); | |
function mycred_pro_pay_profit_from_sale( $order_id ) { | |
// Get current user id | |
$cui = get_current_user_id(); |
/** | |
* Reward Store Sales | |
* @version 1.0 | |
*/ | |
function mycred_pro_reward_store_sales( $order_id ) { | |
// Prevent crashes if myCRED gets disabled | |
if ( ! function_exists( 'mycred' ) ) return; | |
// Get order |
/** | |
* Show Cost in Points | |
* Show the cost of a product in points next to the regular price. | |
* @version 1.0 | |
*/ | |
function mycred_pro_append_point_price( $rendered_price, $product ) { | |
if ( $product->get_price() > 0 ) { | |
$price = $product->get_price(); |
/** | |
* Add Points Endpoint | |
* @version 1.0 | |
*/ | |
function mycred_pro_add_points_history_to_woo( $items ) { | |
$items['points'] = 'Points History'; | |
return $items; |
/** | |
* Render Shortcodes in Notifications | |
* @version 1.0 | |
*/ | |
function mycred_pro_render_shortcodes_in_notice( $notice ) { | |
return do_shortcode( $notice ); | |
} | |
add_filter( 'mycred_notifications_note', 'mycred_pro_render_shortcodes_in_notice' ); |
/** | |
* Reward Completed Orders | |
* Will give a user 1 point for each product in an order. | |
* @version 1.0.1 | |
*/ | |
function mycred_pro_reward_completed_orders( $order_id ) { | |
if ( ! function_exists( 'mycred' ) ) return; | |
$order = wc_get_order( $order_id ); |
add_filter( 'mycred_woo_reward_mycred_payment', '__return_true' ); |
<?php | |
/* | |
Plugin Name: TH Shipping Options | |
Plugin URI: NA | |
Description: TH Shipping Options plugin | |
Version: 1.0.0 | |
Author: Vj | |
Author URI: www.wooforce.com | |
*/ |
Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User →
Local by FlyWheel
WordPress install is a custom install