1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<?php
/**
* Product Delivery Date for WooCommerce
*
* This file will use for making compatible Product Delivery date plugin with other plugins.
*
* @author Tyche Softwares
* @package Product-Delivery-Date-Pro-for-WooCommerce/Addon Compatibility
* @todo check the file when it is used and remove if it is not necessary
* @since
*/
if( ! class_exists( 'prdd_addon_compatibility_class' ) ) {
/**
* Class for making Product Delivery Date compatible with other plugins
*
* @since
* @todo check the class and remove if it is not necessary
*/
class prdd_addon_compatibility_class {
/**
* Construct function for initializing
*
* @since
* @todo check the function and remove if it is not necessary
*/
function __construct() {
add_action( 'woocommerce_checkout_create_order_line_item', array( &$this, 'prdd_add_wpa_prices' ), 10, 3 );
}
/**
* Construct function for initializing
*
* @hook woocommerce_checkout_create_order_line_item
*
* @param $item
* @param $cart_item_key
* @param $values
* @since
* @todo check the function when it is used and remove if it is not necessary
*/
public function prdd_add_wpa_prices( $item, $cart_item_key, $values ) {
if ( isset( $values['prdd_delivery'] ) && isset( $values['addons'] ) && count( $values['addons'] ) > 0 ) {
$wpa_total = prdd_common::woo_product_addons_compatibility_cart( $values );
$item->add_meta_data( '_prdd_wpa_prices', $wpa_total );
}
}
}
}
$prdd_addon_compatibility_class = new prdd_addon_compatibility_class();