title: Add Coupon Percentage to Cart Page in WooCommerce
body: <p>I'm trying to display the coupon percentage in the cart page, however I receive several errors.</p>
  <p>This is my custom code:</p>
  <pre><code>// Add Coupon Percentage to Cart
  
  function my_coupon_percentage_cart($value, $coupon)
  {
      if($coupon-&gt;discount_type == 'percent' &amp;&amp; !empty($coupon-&gt;coupon_amount))
      {
          $amt = &quot;&lt;br&gt;&lt;br&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;{$coupon-&gt;coupon_amount}% OFF&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&quot;;   
      }
  
      return $value.$amt;
  }
  add_filter('woocommerce_cart_totals_coupon_html','my_coupon_percentage_cart',10,2);
  </code></pre>
  <p>These are the PHP errors:</p>
  <pre><code>[15-Sep-2022 13:55:13 UTC] discount_type was called incorrectly. Coupon properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_AJAX::do_wc_ajax, do_action('wc_ajax_update_shipping_method'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_AJAX::update_shipping_method, WC_AJAX::get_cart_totals, woocommerce_cart_totals, wc_get_template, include('/plugins/woocommerce/templates/cart/cart-totals.php'), wc_cart_totals_coupon_html, apply_filters('woocommerce_cart_totals_coupon_html'), WP_Hook-&gt;apply_filters, my_coupon_percentage_cart, WC_Legacy_Coupon-&gt;__get, wc_doing_it_wrong. This message was added in version 3.0.
  [15-Sep-2022 13:55:13 UTC] coupon_amount was called incorrectly. Coupon properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_AJAX::do_wc_ajax, do_action('wc_ajax_update_shipping_method'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_AJAX::update_shipping_method, WC_AJAX::get_cart_totals, woocommerce_cart_totals, wc_get_template, include('/plugins/woocommerce/templates/cart/cart-totals.php'), wc_cart_totals_coupon_html, apply_filters('woocommerce_cart_totals_coupon_html'), WP_Hook-&gt;apply_filters, my_coupon_percentage_cart, WC_Legacy_Coupon-&gt;__get, wc_doing_it_wrong. This message was added in version 3.0.
  [15-Sep-2022 13:55:13 UTC] coupon_amount was called incorrectly. Coupon properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_AJAX::do_wc_ajax, do_action('wc_ajax_update_shipping_method'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_AJAX::update_shipping_method, WC_AJAX::get_cart_totals, woocommerce_cart_totals, wc_get_template, include('/plugins/woocommerce/templates/cart/cart-totals.php'), wc_cart_totals_coupon_html, apply_filters('woocommerce_cart_totals_coupon_html'), WP_Hook-&gt;apply_filters, my_coupon_percentage_cart, WC_Legacy_Coupon-&gt;__get, wc_doing_it_wrong. This message was added in version 3.0.
  </code></pre>
  <p>Any idea what could be wrong with my code?</p>