Get discount bar html data using graphQL Api plugin

Retrieve discount bar HTML data using the GraphQL API plugin.

add_action('graphql_register_types', function () {

  register_graphql_field('Product', 'discountTableAndBar', [

  'type' => 'String',
  'description' => 'The HTML for the discount table and bar for this product.',
  'resolve' => function($product) {

  ob_start();
  do_action('advanced_woo_discount_rules_load_discount_bar', wc_get_product($product->get_id()));
  do_action('advanced_woo_discount_rules_load_discount_table', wc_get_product($product->get_id()));

  $html = ob_get_clean();
  return $html;
}
]);
});