<?php

add_action('wp_ajax_wiaas_create_cl_customer_extras', 'wiaas_ajax_create_cl_customer_extras');

function wiaas_ajax_create_cl_customer_extras() {
	check_ajax_referer('wiaas_create_cl_customer_extras');

	$customer_id = absint($_POST['customer_id']);
	$package_id = absint($_POST['package_id']);

	$package = wc_get_product($package_id);

	$configured_prices = Wiaas_Package_Pricing::get_package_prices($package);

	$cl_extras = array();

	foreach ($configured_prices as $type => $configured_price) {
        $cl_extras[$type.'_customer_'.$customer_id] = array(
			'type' => $type,
			'visible' => true,
			'fixed' => 0,
			'services' => 0,
			'recurrent' => 0
		);
	}

	require_once 'views/html-cl-package-prices.php';

	die();

}