WooFrance Dépannage et support WordPress WooCommerce Forums Discussion générale Comment affiché un prix en A partir de …€

11 sujets de 1 à 11 (sur un total de 11)
  • Auteur
    Messages
  • #161238
    Cartier Marine
    Participant
    Points: 13 pts

    Personne pour m’aider ?

    ====================
    depanagewp
    vpsa2
    #161239
    4m.mekha
    Participant
    Points: 49 pts
    Freelance
    Membre 2 étoiles

    Bonjour,

    Il faut mettre ce code dans function php du thème

    add_filter( ‘woocommerce_variable_price_html’, ‘bbloomer_variation_price_format_min’, 9999, 2 );

    function bbloomer_variation_price_format_min( $price, $product ) {

    $prices = $product->get_variation_prices( true );

    $min_price = current( $prices[‘price’] );

    $price = sprintf( __( ‘a partir de  %1$s’, ‘woocommerce’ ), wc_price( $min_price ) );

    return $price;

    }

    ====================
    depanagewp
    vpsa2
    #161240
    Cartier Marine
    Participant
    Points: 13 pts

    Merci mais cela ne fonctionne pas,

    j’ai cette erreur,

    Uncaught Error: syntax error, unexpected ‘partir’ (T_STRING), expecting ‘,’ or ‘)’ in /home/marine91/chicetfeerique-faire-part.com/wp-content/themes/stationery/functions.php on line 34

    • require_once()
      wp-config.php:76
    • require_once()
      wp-load.php:37
    • require_once()
      wp-blog-header.php:13
    • require()
      index.php:17
    <p style= »line-height: 1.5; margin: 25px 0px 20px; »>Une erreur critique est survenue sur votre site.</p>

    ====================
    depanagewp
    vpsa2
    #161246
    4m.mekha
    Participant
    Points: 49 pts
    Freelance
    Membre 2 étoiles

    Parce que vous avez sûrement placé ce code a l’intérieur d’une fonction existante, essayez de placer le même code juste en dessous de /*theme setup */

    ====================
    depanagewp
    vpsa2
    #161247
    Cartier Marine
    Participant
    Points: 13 pts

    Voici mon fichier en entier.

    j’ai regardé je n’est pas le theme setup, je l’ai mis directement dans le fichier funtions.php de mon thème enfant.

    <?php
    /**
     * Stationery engine room
     *
     * @package stationery
     */
    
    /**
     * Set the theme version number as a global variable
     */
    $theme              = wp_get_theme( 'stationery' );
    $stationery_version = $theme['Version'];
    
    $theme              = wp_get_theme( 'storefront' );
    $storefront_version = $theme['Version'];
    
    /**
     * Load the individual classes required by this theme
     */
    require_once( 'inc/class-stationery.php' );
    require_once( 'inc/class-stationery-customizer.php' );
    require_once( 'inc/class-stationery-template.php' );
    require_once( 'inc/class-stationery-integrations.php' );
    require_once( 'inc/plugged.php' );
    
    add_filter( ‘woocommerce_variable_price_html’, ‘bbloomer_variation_price_format_min’, 9999, 2 );
    function bbloomer_variation_price_format_min( $price, $product ) {
    $prices = $product->get_variation_prices( true );
    $min_price = current( $prices[‘price’] );
    $price = sprintf( __( ‘A partir de  %1$s’, ‘woocommerce’ ), wc_price( $min_price ) );
    return $price;
    }
    
    /**
     * Do not add custom code / snippets here.
     * While Child Themes are generally recommended for customisations, in this case it is not
     * wise. Modifying this file means that your changes will be lost when an automatic update
     * of this theme is performed. Instead, add your customisations to a plugin such as
     * https://github.com/woothemes/theme-customisations
     */
    ====================
    depanagewp
    vpsa2
    #161257
    4m.mekha
    Participant
    Points: 49 pts
    Freelance
    Membre 2 étoiles

    Utilisez

    https://fr.wordpress.org/plugins/code-snippets/ pour ajoutez du code perso

    ====================
    depanagewp
    vpsa2
    #161256
    4m.mekha
    Participant
    Points: 49 pts
    Freelance
    Membre 2 étoiles

    /**

    * Do not add custom code / snippets here.

    * While Child Themes are generally recommended for customisations, in this case it is not

    * wise. Modifying this file means that your changes will be lost when an automatic update

    * of this theme is performed. Instead, add your customisations to a plugin such as

    * https://github.com/woothemes/theme-customisations

    Il est précisé ici de ne pas mettre de code personnalisé. Utilisez plutôt le plugins code snippet pour ajouter du code perso.

    Code Snippets

    ====================
    depanagewp
    vpsa2
    #161944
    Guy
    Participant
    Points: 5,498 pts
    ModérateurCertifiéFreelance
    Membre 2 étoiles

    Voici mon fichier en entier.

    j’ai regardé je n’est pas le theme setup, je l’ai mis directement dans le fichier funtions.php de mon thème enfant.

    <?php
    /**
     * Stationery engine room
     *
     * @package stationery
     */
    
    /**
     * Set the theme version number as a global variable
     */
    $theme              = wp_get_theme( 'stationery' );
    $stationery_version = $theme['Version'];
    
    $theme              = wp_get_theme( 'storefront' );
    $storefront_version = $theme['Version'];
    
    /**
     * Load the individual classes required by this theme
     */
    require_once( 'inc/class-stationery.php' );
    require_once( 'inc/class-stationery-customizer.php' );
    require_once( 'inc/class-stationery-template.php' );
    require_once( 'inc/class-stationery-integrations.php' );
    require_once( 'inc/plugged.php' );
    
    add_filter( ‘woocommerce_variable_price_html’, ‘bbloomer_variation_price_format_min’, 9999, 2 );
    function bbloomer_variation_price_format_min( $price, $product ) {
    $prices = $product->get_variation_prices( true );
    $min_price = current( $prices[‘price’] );
    $price = sprintf( __( ‘A partir de  %1$s’, ‘woocommerce’ ), wc_price( $min_price ) );
    return $price;
    }
    
    /**
     * Do not add custom code / snippets here.
     * While Child Themes are generally recommended for customisations, in this case it is not
     * wise. Modifying this file means that your changes will be lost when an automatic update
     * of this theme is performed. Instead, add your customisations to a plugin such as
     * https://github.com/woothemes/theme-customisations
     */

    Compare les guillemets simples du code que tu as ajouté avec ceux du code précédent.

    Content(e) de mon aide ? Vous pouvez m'offrir un café ! 🙂

    Avant d'appeler à l'aide: Dépannage Woocommerce

    ====================
    depanagewp
    vpsa2
    1 user thanked author for this post.
    #161963
    Cartier Marine
    Participant
    Points: 13 pts

    Bonjour,

    Merci, j’ai trouvé un autre code qui était adapté au plugin que j’utilise pour la variation des tarifs.

    Cordialement

    Marine

    ====================
    depanagewp
    vpsa2
    #161139
    4m.mekha
    Participant
    Points: 49 pts
    Freelance
    Membre 2 étoiles

    Bonjour,

    Avez vous essayer d’ajouter ce code :

    /**
     * @snippet       Variable Product Price Range: "From: $$$min_price"
     * @how-to        Get CustomizeWoo.com FREE
     * @sourcecode    https://businessbloomer.com/?p=275
     * @author        Rodolfo Melogli
     * @compatible    WooCommerce 3.5.4
     * @donate $9     https://businessbloomer.com/bloomer-armada/
     */
    add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format_min', 9999, 2 );
     
    function bbloomer_variation_price_format_min( $price, $product ) {
       $prices = $product->get_variation_prices( true );
       $min_price = current( $prices['price'] );
       $price = sprintf( __( 'A partir de %1$s', 'woocommerce' ), wc_price( $min_price ) );
       return $price;
    }

    Dites nous si cela à marché

     

    ====================
    depanagewp
    vpsa2
    #161140
    4m.mekha
    Participant
    Points: 49 pts
    Freelance
    Membre 2 étoiles

    Bonjour,

    Il faut ajouter le code suivant sur le function.php de votre theme actif

    /**
    * @snippet Variable Product Price Range: « From: $$$min_price »
    * @how-to Get CustomizeWoo.com FREE
    * @sourcecode https://businessbloomer.com/?p=275
    * @author Rodolfo Melogli
    * @compatible WooCommerce 3.5.4
    * @donate $9 https://businessbloomer.com/bloomer-armada/
    */

    add_filter( ‘woocommerce_variable_price_html’, ‘bbloomer_variation_price_format_min’, 9999, 2 );

    function bbloomer_variation_price_format_min( $price, $product ) {
    $prices = $product->get_variation_prices( true );
    $min_price = current( $prices[‘price’] );
    $price = sprintf( __( ‘From: %1$s’, ‘woocommerce’ ), wc_price( $min_price ) );
    return $price;
    }

     

    Ca devrait marcher,

    Merci

    ====================
    depanagewp
    vpsa2
11 sujets de 1 à 11 (sur un total de 11)
  • Vous devez être connecté pour répondre à ce sujet.