autoship_all_prices_array

Applied through the autoship_get_product_prices function (src > product-options.php). It takes parameters of prices (array), product, and product id. One way you can use this to change the displayed discount percentage as shown in: Calculate the Autoship Discount Based on Sale Price

/**
* Retrieves all of a products prices ( the Autoship & WC ).
* NOTE: This value can be modified via the autoship_all_prices_array filter.
*
* @param int $product_id. The product or variation id.
* @return array The Autoship and WC prices
*/
function autoship_get_product_prices( $product_id ){

  // Get the Product
  $product = wc_get_product( $product_id );

  $prices = array();
  $prices['autoship_checkout_price']            = autoship_get_product_checkout_price( $product_id );
  $prices['autoship_recurring_price']           = autoship_get_product_recurring_price( $product_id );
  $prices['regular_price']                      = $product->get_regular_price();
  $prices['sale_price']                         = $product->get_sale_price();
  $prices['autoship_percent_discount']          = autoship_percent_discount( $product );
  $prices['autoship_percent_recurring_discount']= autoship_percent_recurring_discount( $product );

  return apply_filters('autoship_all_prices_array', $prices, $product_id, $product );
}

Still need help? Contact Us Contact Us