• Resolved stathis_k91

    (@stathis_k91)


    Hi,

    can you please help me what function needed to remove sku strings in the middle of product title?

    example title: Reebok Αθλητικ? Παπο?τσι Αγ?ρι Royal Cljog EF3740 – ΧΑΚΙ
    remove sku: EF3740

    another one example: Us Golf Club Κλειστ? Π?διλο Αγ?ρι S20-SUK653 – ΜΠΛΕ-ΚΙΤΡΙΝΟ
    remove sku: S20-SUK653

    Regards,
    Stathis

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hey @stathis_k91,

    If the SKU is always right before the dash, and there’s a space before it, something like this should work (note: untested example that may need to be adjusted):

    function my_remove_sku( $title ) {
    	$title = explode( ' - ', $title );
    	$first = explode( ' ', $title[0] );
    	array_pop( $first );
    	return implode( ' ', $first ) . ' - ' . $title[1];
    }
    Thread Starter stathis_k91

    (@stathis_k91)

    Hi,

    doesn’t work,

    for this title: Reebok Αθλητικ? Παπο?τσι Αγ?ρι Royal Cljog EF3740 – ΧΑΚΙ
    it returned: Reebok Αθλητικ? Παπο?τσι Αγ?ρι Royal Cljog EF3740 – –

    for a title like this: Us Golf Club Κλειστ? Π?διλο Αγ?ρι S20-SUK653 – ΜΠΛΕ-ΚΙΤΡΙΝΟ
    it returned: Us Golf Club Κλειστ? Π?διλο Αγ?ρι S20-SUK653 – –

    Regards,
    Stathis

    Plugin Author WP All Import

    (@wpallimport)

    Hi @stathis_k91,

    I’m afraid I don’t have any more examples. You’ll need to adjust the code to make it work.

    Thread Starter stathis_k91

    (@stathis_k91)

    Thanks support team.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove strings from title’ is closed to new replies.