Api

IMPORTANT: when using one or more of these functions, you must check for its existence before using it, otherwise your site will badly break with a fatal error at the next Plugin update (as WordPress deletes the plugin when updating it).

Get Top clicked items:

 if(function_exists('ricApi')){
	$data = ricApi()->get_top_clicked();
 }
returning data:
array(5) {
  [0]=>
  array(5) {
    ["title"]=>
    string(17) "WordPress Pennant"
    ["image"]=>
    string(78) "https://domain.domain/wp-content/uploads/2023/03/pennant-1-150x150.jpg"
    ["url"]=>
    string(56) "https://domain.domain/product/wordpress-pennant/"
    ["wp_id"]=>
    string(2) "36"
    ["wp_type"]=>
    string(7) "product"
  }
}

if(function_exists('ricApi')){
	$data = ricApi()->get_top_addedtocart();
 }
returning data:
array(5) {
  [0]=>
  array(5) {
    ["title"]=>
    string(17) "WordPress Pennant"
    ["image"]=>
    string(78) "https://domain.domain/wp-content/uploads/2023/03/pennant-1-150x150.jpg"
    ["url"]=>
    string(56) "https://domain.domain/product/wordpress-pennant/"
    ["wp_id"]=>
    string(2) "36"
    ["wp_type"]=>
    string(7) "product"
  }
}

if(function_exists('ricApi')){
	$data = ricApi()->get_top_purchaed();
 }
returning data:
array(5) {
  [0]=>
  array(5) {
    ["title"]=>
    string(17) "WordPress Pennant"
    ["image"]=>
    string(78) "https://domain.domain/wp-content/uploads/2023/03/pennant-1-150x150.jpg"
    ["url"]=>
    string(56) "https://domain.domain/product/wordpress-pennant/"
    ["wp_id"]=>
    string(2) "36"
    ["wp_type"]=>
    string(7) "product"
  }
}


 if(function_exists('ricApi')){
	$data = ricApi()->get_promotion(id);
 }
returning data:
array(2) {
  ["title"]=>
  string(5) "fffff"
  ["items"]=>
  array(2) {
    [0]=>
    array(5) {
      ["title"]=>
      string(15) "Logo Collection"
      ["wp_id"]=>
      string(2) "35"
      ["url"]=>
      string(54) "https://domain.domain/product/wordpress-pennant/"
      ["image"]=>
      string(75) "https://domain.domain/ricerca-test/wp-content/uploads/2023/03/logo-1-150x150.jpg"
      ["wp_type"]=>
      string(7) "product"
    }
    [1]=>
    array(5) {
      ["title"]=>
      string(16) "Beanie with Logo"
      ["wp_id"]=>
      string(2) "34"
      ["url"]=>
      string(55) "https://domain.domain/product/beanie-with-logo/"
      ["image"]=>
      string(87) "https://domain.domain/wp-content/uploads/2023/03/beanie-with-logo-1-150x150.jpg"
      ["wp_type"]=>
      string(7) "product"
    }
  }
}