position a div within WooCommerce and set it to a fixed position

Beginner in the world of CSS.

/// Currently experiencing challenges with one of my web pages.

Struggling to properly position the display of the price.

Experimented with both absolute and clear attributes.

The CSS works fine at a width of 1920px

*Guy Ytzhak came to my rescue and solved the issue.

Answer №1

To remove the price from its default position under the title on your single product page, insert this code into your functions.php file within your theme folder:

remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);

You can then add the price back in at a different location on the page by using the following action (for example):

add_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 35);

In this case, the price is being removed at priority 10 and added back in at priority 35.

The regular priorities in the WooCommerce single product page are as follows:

/**
       * Hook: Woocommerce_single_product_summary.
       *
       * @hooked woocommerce_template_single_title - 5
       * @hooked woocommerce_template_single_rating - 10
       * @hooked woocommerce_template_single_price - 10
       * @hooked woocommerce_template_single_excerpt - 20
       * @hooked woocommerce_template_single_add_to_cart - 30
       * @hooked woocommerce_template_single_meta - 40
       * @hooked woocommerce_template_single_sharing - 50
       * @hooked WC_Structured_Data::generate_product_data() - 60
       */

If you use a priority of 35, it will be positioned between 'woocommerce_template_single_add_to_cart' and 'woocommerce_template_single_meta'.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Counter for the type="range" HTML input

I recently read an article discussing the possibilities of displaying ticks in Chrome and Firefox for a number input with the type "range". I was intrigued to find out more about this feature and came across a helpful discussion on Stack Overflow. ...

What techniques can be used to implement a diagonal gradient using CSS3?

Looking to make a responsive button? Take a look at this image: https://i.sstatic.net/23GsY.jpg I've attempted recreating it with CSS3, as embedding the image directly wasn't giving me the desired responsiveness. The challenge lies in creating ...

Tips on using css filters on a fixed background image

I am currently working on a website that features a fixed background image with scrollable elements on top. I am facing an issue where applying a grayscale filter to the image also affects the text within the container, turning it gray as well. However, I ...

Implementing a feature that loads older posts on a webpage as users scroll down

Spent hours trying to get my site to automatically load older posts on scroll down with no luck. Any assistance is greatly appreciated :) After researching, [this tutorial][1] seemed like the best solution so I followed it step by step and integrated ever ...

Looking to utilize the <pre> tag without any external CSS styles defined in a separate stylesheet?

In my current project, I am using bootstreap v3.2. I am facing an issue where I need to display fetched content from the database on a page using the <pre></pre> tags. However, the problem is that the content is being displayed with the default ...

Tips for Arranging HTML Elements Next to Each Other with CSS3

As a beginner in programming, I am embarking on the task of creating a basic website inspired by a dribble design. I am currently struggling to align an image and text side by side within a section, so that they stack on top of each other when the screen ...

Ensuring Consistent Height for a Responsive HTML Document Across Devices

My html page is facing a problem when printing from different Android devices. The page height changes dynamically based on label updates through JavaScript, and I pass this height to adjust the printed page (approximately 856x3000 pixels). However, issu ...

Tips and insights on developing a personalized theme selector for Django: brainstorming and recommendations

As I continue to enhance my Django website, I am seeking advice on incorporating graphic charts and how to integrate them with Django. During the development of my software, I implemented a graphic chart that aligns with my company's colors (blue and ...

CSS media queries going unnoticed

I'm struggling to make my page look nice on both iphone4 and iphone 5. Despite writing some media queries, they don't seem to be taking effect: @media only screen and (max-device-width: 480px) { #gpsMain{ position:absolute; top:25px; ...

"Enhance Your Browsing Experience with Firefox's Animation

I have successfully implemented an animation within a div element that is functioning perfectly in the Chrome browser. Below is the code snippet... @-webkit-keyframes adjustHue { 0% { -webkit-filter: hue-rotate(0deg); } 25% { -webkit-filter: hue- ...

The functionality of a Cordova application using Framework 7 CSS can vary across different Android devices

A link is shared for reference showcasing how the progress bar appears on Samsung j2 and other Android devices. Here is the link: [https://i.sstatic.net/C9OpS.jpg](https://i.sstatic.net/C9OpS.jpg) On my personal device, the progress bar is displayed at th ...

css - the art of centering span text within a rounded button

CodeSandbox: https://codesandbox.io/s/eloquent-haibt-1bnib?file=/src/main.js https://i.sstatic.net/HDtft.png I'm trying to center the dash text within a button, but I'm struggling to find a solution. html <button class="round-butto ...

steps for applying a vertical-align:bottom with an additional 10px offset

Can you show me how to have two inline-blocks with the second one positioned 10 pixels up from the bottom? I'm not sure how to do this. Here is a snippet of my code: .test1{ display:inline-block; border: 1px solid red; min-height: 50px; } .tes ...

How can I make a single block expand and have the option to uncheck it by clicking again?

Currently, I am in the process of creating a small program for a website where I intend for certain blocks to expand almost to the size of the window when clicked on to reveal text. Unfortunately, using checkboxes seems to cause all boxes to grow, and with ...

The CSS styles do not seem to be taking effect on the Bootstrap

Here's a snippet of code extracted from my website's html and css files. My intention is to make the navbar slightly transparent with centered links, but for some reason, the css styles are not applying correctly to the navbar. HTML <body ...

The height attribute is not functioning properly in Mozilla Firefox

I am facing an issue on my website where I set the height of the body tag to 1460px. It works perfectly on Chrome and IE, but there are problems on Firefox. See my code below: body { background-image: url('../images/background.jpg&apos ...

Steps for accessing the `<img>` tag within an `<a>` tag to focus on the `<img>` element in Internet Explorer

How can I target the img tag inside an href tag to set focus on the <img> element? For example: <a href="#"><img class="img1" src="abc.png"/></a> The CSS selector a .img1:focus {} does not seem to work. I am unable to access the ...

Tips for creating slanted div borders

I am working on a project where I have 4 divs serving as background colors. I want to create slanted bottom borders similar to the design in this image: Below is the code I currently have: <html> <head> <style> html, body { height: 200% ...

Issue with bootstrap-selectpicker not updating the width of the selection box

I've been attempting to adjust the width of the selectpicker box that displays selected options, but so far all my efforts have been fruitless. I can't seem to change the width or color of the box. If anyone has any ideas or suggestions, they wo ...

Customize PrimeNG component styles

Utilizing the PrimeNG OverlayPanel for a dropdown click feature, I am encountering an issue with moving the default left arrow to the right position. Despite trying various solutions, I have reached a dead end. Would you be able to provide me with some fr ...