• Si necesitas crear texto personalizado en algunos tickets agotados:

    Add text in some out-of-stock/sold out tickets: In addition to Sold out, you can add extra text. Copy the original file unavailable.php. and paste it into your child-theme following these steps:

    a. Create categories in the event categories In WordPress
    b. Create a folder named /tribe/ in your chield-theme and create the route /tribe/tickets/v2/item/quantity/unavailable.php In this way, when you update the events calendar or tickets, the changes will not be altered. And change

    <?php
    /**
    * Block: Tickets
    * Quantity Unavailable
    *
    * Override this template in your own theme by creating a file at:
    * [your-theme]/tribe/tickets/v2/tickets/item/quantity/unavailable.php
    */

    // Get the event categories for the current event
    $event_categories = wp_get_post_terms( $post_id, 'tribe_events_cat', ['fields' => 'slugs'] );

    // Default text for "Sold Out"
    $default_text = esc_html_x( 'Sold Out', 'Tickets are sold out.', 'event-tickets' );

    // Custom text for the specific category
    $custom_text = esc_html_x( 'Sold Out, tickets available at the door', 'Tickets are sold out.', 'event-tickets' );

    // Check if the event belongs to the "general" category
    $is_in_general_category = in_array( 'general', $event_categories );

    ?>
    <div class="tribe-common-b2 tribe-common-b2--bold tribe-tickets__tickets-item-quantity-unavailable">
    <?php if ( $is_in_general_category ) : ?>
    <!-- Display custom text for events in the "general" category -->
    <?php echo $custom_text; ?>
    <?php else : ?>
    <!-- Display the default text -->
    <?php echo $default_text; ?>
    <?php endif; ?>
    </div>

    If you want the custom message to apply to multiple categories, update the check like this:

    $is_in_general_category = array_intersect( ['general', 'special'], $event_categories );

    That’s all and rock and roll 🤘🏼

The topic ‘Sold Out text extra options?’ is closed to new replies.