Link to home
Create AccountLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

Wordpress Woocommerce Rentals Plugin

In the Rentals Plugin documentation it says:
For custom development you can use the functions below:
FunctionReturn
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;

}

Avatar of Alicia St Rose
Alicia St Rose
Flag of United States of America image

Have you contacted the plugin developer and received no reply?

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.
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/
User generated image


ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer