Robert Granlund
asked on
Wordpress Woocommerce Rentals Plugin
In the Rentals Plugin documentation it says:
For custom development you can use the functions below:
Here is the function:
function wcrp_rental_products_default_rental_options() {
$options = array();
$options['_wcrp_rental_products_rental'] = '';
$options['_wcrp_rental_products_pricing_type'] = 'period';
$options['_wcrp_rental_products_pricing_period'] = '1';
$options['_wcrp_rental_products_pricing_period_multiples'] = 'no';
$options['_wcrp_rental_products_pricing_tiers'] = 'no';
$options['_wcrp_rental_products_pricing_tiers_data'] = array(
'days' => array(
'0' => '1'
),
'percent' => array(
'0' => '0'
),
);
$options['_wcrp_rental_products_minimum_days'] = '1';
return $options;
}
How do I change these in my functions.php? I tried to add a filter but the following does not work:
add_filter('wcrp_rental_products_default_rental_options', 'trove_custom_rental_product_settings', 50, 1);
function trove_custom_rental_product_settings($options) {
$options = array();
$options['_wcrp_rental_products_rental'] = 'yes_purchase';
$options['_wcrp_rental_products_pricing_type'] = 'period';
$options['_wcrp_rental_products_pricing_period'] = '1';
$options['_wcrp_rental_products_pricing_period_multiples'] = 'no';
$options['_wcrp_rental_products_pricing_tiers'] = 'no';
return $options;
}
For custom development you can use the functions below:
Function | Return |
wcrp_rental_products_default_rental_options() | Array of the default rental options |
Here is the function:
function wcrp_rental_products_default_rental_options() {
$options = array();
$options['_wcrp_rental_products_rental'] = '';
$options['_wcrp_rental_products_pricing_type'] = 'period';
$options['_wcrp_rental_products_pricing_period'] = '1';
$options['_wcrp_rental_products_pricing_period_multiples'] = 'no';
$options['_wcrp_rental_products_pricing_tiers'] = 'no';
$options['_wcrp_rental_products_pricing_tiers_data'] = array(
'days' => array(
'0' => '1'
),
'percent' => array(
'0' => '0'
),
);
$options['_wcrp_rental_products_minimum_days'] = '1';
return $options;
}
How do I change these in my functions.php? I tried to add a filter but the following does not work:
add_filter('wcrp_rental_products_default_rental_options', 'trove_custom_rental_product_settings', 50, 1);
function trove_custom_rental_product_settings($options) {
$options = array();
$options['_wcrp_rental_products_rental'] = 'yes_purchase';
$options['_wcrp_rental_products_pricing_type'] = 'period';
$options['_wcrp_rental_products_pricing_period'] = '1';
$options['_wcrp_rental_products_pricing_period_multiples'] = 'no';
$options['_wcrp_rental_products_pricing_tiers'] = 'no';
return $options;
}
That function, along with the others in the documentation, are for getting, not setting. wcrp_rental_products_default_rental_options() will show you the default options you have set up.
https://docs.woocommerce.com/document/rental-products/
https://docs.woocommerce.com/document/rental-products/
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
The most efficient way to get your question answered regarding a plugin is to contact the dev first. Each dev codes differently and adheres to WP standards differently.
I've been in the same boat and the devs have been extremely helpful. And when they went AWOL, to be honest, I looked for another plugin.