'_precio_dinamico_inicial',
'label' => __('Precio Inicial para Dinámico', 'woocommerce'),
'desc_tip' => 'true',
'description' => __('Introduce el precio inicial para el descuento dinámico.', 'woocommerce'),
'type' => 'number',
'custom_attributes' => array('step' => 'any')
));
// Agregar campo para el precio mínimo
woocommerce_wp_text_input( array(
'id' => '_precio_dinamico_minimo',
'label' => __('Precio Mínimo para Dinámico', 'woocommerce'),
'desc_tip' => 'true',
'description' => __('Introduce el precio mínimo al que puede bajar.', 'woocommerce'),
'type' => 'number',
'custom_attributes' => array('step' => 'any')
));
// Agregar campo para el descuento por segundo
woocommerce_wp_text_input( array(
'id' => '_descuento_por_segundo',
'label' => __('Descuento por Segundo', 'woocommerce'),
'desc_tip' => 'true',
'description' => __('Introduce la cantidad que baja el precio por segundo.', 'woocommerce'),
'type' => 'number',
'custom_attributes' => array('step' => 'any')
));
}
// Guardar los valores de los campos personalizados
add_action('woocommerce_process_product_meta', 'guardar_campos_personalizados_precio_dinamico');
function guardar_campos_personalizados_precio_dinamico($post_id) {
// Obtener y guardar el precio inicial
$precio_inicial = isset($_POST['_precio_dinamico_inicial']) ? sanitize_text_field($_POST['_precio_dinamico_inicial']) : '';
update_post_meta($post_id, '_precio_dinamico_inicial', $precio_inicial);
// Obtener y guardar el precio mínimo
$precio_minimo = isset($_POST['_precio_dinamico_minimo']) ? sanitize_text_field($_POST['_precio_dinamico_minimo']) : '';
update_post_meta($post_id, '_precio_dinamico_minimo', $precio_minimo);
// Obtener y guardar el descuento por segundo
$descuento_por_segundo = isset($_POST['_descuento_por_segundo']) ? sanitize_text_field($_POST['_descuento_por_segundo']) : '';
update_post_meta($post_id, '_descuento_por_segundo', $descuento_por_segundo);
}
// Aplicar el precio dinámico al producto
add_filter('woocommerce_get_price_html', 'precio_dinamico_ciclo_personalizado', 10, 2);
function precio_dinamico_ciclo_personalizado($precio, $producto) {
// Verificar si el precio dinámico está activado para este producto
$precio_dinamico_activado = get_post_meta($producto->get_id(), '_precio_dinamico_activado', true);
if ($precio_dinamico_activado === 'yes') {
// Obtener los valores personalizados
$precio_inicial = get_post_meta($producto->get_id(), '_precio_dinamico_inicial', true);
$precio_minimo = get_post_meta($producto->get_id(), '_precio_dinamico_minimo', true);
$descuento_por_segundo = get_post_meta($producto->get_id(), '_descuento_por_segundo', true);
// Valor por defecto si no se establecieron
$precio_inicial = $precio_inicial ? $precio_inicial : $producto->get_regular_price();
$precio_minimo = $precio_minimo ? $precio_minimo : 10;
$descuento_por_segundo = $descuento_por_segundo ? $descuento_por_segundo : 0.001;
// Obtener el tiempo de inicio desde el custom field del producto
$tiempo_inicio = get_post_meta($producto->get_id(), '_tiempo_inicio_descuento', true);
if (!$tiempo_inicio) {
$tiempo_inicio = time(); // Si no existe, inicializar con la hora actual
update_post_meta($producto->get_id(), '_tiempo_inicio_descuento', $tiempo_inicio);
}
$tiempo_actual = time(); // Hora actual
$nuevo_precio = $precio_inicial - (($tiempo_actual - $tiempo_inicio) * $descuento_por_segundo);
// Si el precio ha llegado al mínimo, reiniciar al precio inicial y el tiempo
if ($nuevo_precio <= $precio_minimo) {
$nuevo_precio = $precio_inicial;
$tiempo_inicio = time(); // Reiniciar el tiempo de descuento
update_post_meta($producto->get_id(), '_tiempo_inicio_descuento', $tiempo_inicio);
}
// Actualizar el precio del producto
$producto->set_price($nuevo_precio);
return wc_price($nuevo_precio);
}
// Si el precio dinámico no está activado, devuelve el precio normal
return $precio;
}
¡Obtén acceso gratuito a esta valiosa colección de 5 artículos de alta calidad PLR sobre mejora del hogar! Si estás buscando información útil y práctica para transformar y embellecer tu hogar, ¡has llegado al lugar correcto!
En esta exclusiva oferta, te presentamos 5 artículos de alta calidad PLR que cubren diversos aspectos de la mejora del hogar. Estos artículos han sido cuidadosamente redactados por expertos en el campo y ahora puedes aprovecharlos de forma gratuita.
¡Obtén acceso gratuito a esta valiosa colección de 5 artículos de alta calidad PLR sobre mejora del hogar! Si estás buscando información útil y práctica para transformar y embellecer tu hogar, ¡has llegado al lugar correcto!
En esta exclusiva oferta, te presentamos 5 artículos de alta calidad PLR que cubren diversos aspectos de la mejora del hogar. Estos artículos han sido cuidadosamente redactados por expertos en el campo y ahora puedes aprovecharlos de forma gratuita.
3 reviews for 5 artículos gratis de alta calidad PLR Mejora del hogar
Rated 5 out of 5
David E. Smith –
Dear Website Owner,
I hope this email finds you well. I recently discovered your website and was impressed by the quality of your content and the helpful information you offer to your audience. In light of this, I would like to propose a backlink exchange that could benefit both our websites.
My website, https://m.cheapestdigitalbooks.com/, is focused on providing affordable digital books to readers around the world. We currently have a strong online presence with a Domain Authority (DA) of 13, a Page Authority (PA) of 52, and a Domain Rating (DR) of 78. Our website features 252K backlinks, with 95% of them being dofollow, and has established connections with 5.3K linking websites, with 23% of these being dofollow links.
I believe that a mutually beneficial backlink exchange could be of great value for both of our websites, as it may lead to an increase in website authority and improve our search engine rankings. In this collaboration, I am willing to add backlinks from my website using your desired keywords and anchor texts. In return, I would be grateful if you could include backlinks with my desired keywords and anchor texts on your website.
I kindly request that you visit my website, https://m.cheapestdigitalbooks.com/, to get a sense of the potential benefits this partnership could bring to your site. I am confident that this collaboration will provide a win-win situation for both parties, and I look forward to learning more about your thoughts on this proposal.
Thank you for considering my offer. I am excited about the potential growth this partnership may bring to our websites and am eager to discuss the details further. Please do not hesitate to reach out to me at your convenience.
Hi there! I’m at work browsing your blog from my new iphone 4!
Just wanted to say I love reading your blog and look forward to all your posts!
Carry on the excellent work!
Rated 5 out of 5
Alberto D. Harris –
Pretty! This has been a really wonderful article. Many thanks for providing this information.
Utilizamos cookies propias y de terceros para mejorar nuestros servicios y mostrarle publicidad relacionada con sus preferencias mediante el análisis de sus hábitos de navegación. Si continua navegando, consideramos que acepta su uso. Puede obtener más información, o bien conocer cómo cambiar la configuración de su navegador.
Functional
Siempre activo
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
David E. Smith –
Dear Website Owner,
I hope this email finds you well. I recently discovered your website and was impressed by the quality of your content and the helpful information you offer to your audience. In light of this, I would like to propose a backlink exchange that could benefit both our websites.
My website, https://m.cheapestdigitalbooks.com/, is focused on providing affordable digital books to readers around the world. We currently have a strong online presence with a Domain Authority (DA) of 13, a Page Authority (PA) of 52, and a Domain Rating (DR) of 78. Our website features 252K backlinks, with 95% of them being dofollow, and has established connections with 5.3K linking websites, with 23% of these being dofollow links.
I believe that a mutually beneficial backlink exchange could be of great value for both of our websites, as it may lead to an increase in website authority and improve our search engine rankings. In this collaboration, I am willing to add backlinks from my website using your desired keywords and anchor texts. In return, I would be grateful if you could include backlinks with my desired keywords and anchor texts on your website.
I kindly request that you visit my website, https://m.cheapestdigitalbooks.com/, to get a sense of the potential benefits this partnership could bring to your site. I am confident that this collaboration will provide a win-win situation for both parties, and I look forward to learning more about your thoughts on this proposal.
Thank you for considering my offer. I am excited about the potential growth this partnership may bring to our websites and am eager to discuss the details further. Please do not hesitate to reach out to me at your convenience.
Best regards,
David E. Smith
Email: david@cheapestdigitalbooks.com
Address: 3367 Hood Avenue, San Diego, CA 92117
wwd.com –
Hi there! I’m at work browsing your blog from my new iphone 4!
Just wanted to say I love reading your blog and look forward to all your posts!
Carry on the excellent work!
Alberto D. Harris –
Pretty! This has been a really wonderful article. Many thanks for providing this information.