You are not giving much detail, but I will do as much as I can.
The best way to approach this, is to do that directly via PHP (without jQuery). So, assuming that the product title is displayed via the_title()
between <h1>
tags, as such:
<h1><?php the_title(); ?></h1>
Then I would add the following pseudo-code as follows:
<h1><?php the_title(); ?>
<span>
<?php
if (promo-price exists) {
// 1. Code to get promo price and promo code from DB
$promo_price = Somehow get from DB;
$promo_code = Also get from DB;
// 2. Code to display text
$price_details = sprintf(' - $%d with promo code: %s', $promo_price, $promo_code);
echo $price_details;
}
?>
</span>
</h1>
Remember, this is pseudo-code and you must modify according to your needs.
Related Posts:
- AJAX to add to cart multiple products woocommerce
- How to echo a PHP code into WooCommerce variation product?
- How to correctly add Javascript in functions.php
- Combine CSS and JS files from plugins
- JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error
- WordPress Ajax always returns a 404 error
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- How to use WordPress (PHP) functions in AngularJS partials files?
- Nice scroll to wordpress
- Remove commas from WooCommerce checkout addresses fields
- Using an Image Slider twice on the same page
- Click loads template via ajax
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- Access/update database with jQuery
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- How to speed up admin-ajax.php in wordpress
- JQuery not working on WordPress Admin page [closed]
- How to make custom total price reactive in navigation
- Sending jsPDF documents to the server
- How to prevent those PHP variables from being cached on WordPress?
- Ajax return code 400
- Show post in slider
- How to test nonce with AJAX – Plugin development
- How do I display a user’s previous orders as a select box option on a product?
- js file in root loading without
- combine Code 1 with Code 2
- WooCommerce – Reset quantity input field when variation changes
- Slider loading issue
- AJAX request status 200 but no actual “response”
- How to select the contents in the text view textrea in wp_editor?
- Status 400 for AJAX POST Request with admin-ajax.php
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Save Search System
- dynamic dependent select dropdown
- Change “add to cart” button color based on Woocommerce product category [closed]
- How can I get the values of my WordPress $wpdb query in Jquery?
- Ajax load more button for comments wordpress
- How to add a do_action on refreshing of WP customizer?
- Menu jumping when calling it via PHP
- Setting value of session with Ajax not working
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Add / Update Custom Fields After Select Pictures in Media Window
- Fancybox type popup window that’s not an iframe
- How do I Import / Upload Files with jQuery AJAX?
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Error – ‘create_function is deprecated’ [closed]
- get taxonomy thumbnail and use it as a variable in code
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Is it save to use eval for a jQuery callback method coming from the database?
- Jquery window.send_to_editor function
- How to add drag and drop functionalities to a div inside option panel
- Why i can’t get custom fields value or post ID via Ajax?
- JS file is not loading when i put wp_head() and wp_footer
- Accessing an API with jQuery and AJAX
- Replacing WordPress Icons (menu,icons32, etc)?
- Covert WordPress Blogname into JQuery
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- Execute PHP code only with specific user role
- Hot to check if new posts have been published since page load and notify online users?
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Creating a brand attribute as a variable
- Variation prices breakdown only for single product page
- WooCommerce Query Product Titles
- Display custom field value in woocommerce variable product via jQurey
- Woocommerce disable order item link (backend) [closed]
- Add other class content with reference class value
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- How to use wp_ajax_set_post_thumbnail?
- Woocommerce – if selected attribute term equals
- Using wp_editor() when not logged stopped working
- Show the subcategory name based on current product
- Move Jquery.js to Footer
- How to call a function from functions.php with ajax?
- WordPress load javascript file if something… (after the page is loaded)
- include javascript Multiple files in wordpress through script.js
- number of posts with “Load More”
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Find the method which AJAX GET calls
- Display text of price (minus 20%) on every product page in a sentence.
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- How to create a radio button to alt between settings in wp_options table
- jQuery doesn’t work in my php snippet
- Add a downloaded JS file to WordPress
- Slider from different widgets
- How to call javascript function (jquery) in a shortcode?
- How can I correctly POST to a WordPress page?
- Why this plugin is not working?
- Trying to fix multiple category drop down
- JSON Object Value Show Undefine
- Adding jquery using php function
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- notify users when changed database
- Replace the image of a product with its video in the shop page
- Remove Woocommerce product from cart with ajax/fetch
- WooCommerce Modal Fly cart on add to cart – With AJAX
- get_post_meta returns on side but it doesn’t return on bottom of admin page